Zymic

Webmaster resources

Professional XHTML & CSS Coding

Including Wordpress & Vbulletin from $145 - Learn More

PHP & MySQL

Free Tutorials » PHP & MySQL » Creating a file upload form with PHP

Learn the basics of coding an upload file form in PHP.

Tutorial comments

26.08.2008 -

creejon says …

This was rather easy and did not take long to grasp the syntax especially with the comments etc. Rather surprised at how fast I was able to get this up and working. Thanks.

20.08.2008 -

kenshin1733 says …

i wanna know how to change the php.ini file to increase the upload size...

19.08.2008 -

huyannet says …

Ai hiểu về cái này thì chỉ tui với nào.
Tôi tạo 1 file upload.html như trên, 1 file upload.php như trên và up lên host. Sau đó tôi chạy file upload.html và chọn upload để tiến hành, nhưng ko được. Ai biết thì chỉ với

18.08.2008 -

blobinator11 says …

Very well written, thanks! It works perfectly.

05.08.2008 -

Stryke says …

Nothing happens when I click upload :(

02.08.2008 -

rock225196 says …

is it possible to add a random number to the end of the file that's being uploaded so that there will be no overlap?

31.07.2008 -

FlashRevival says …

Finally one that works, I love you man, seriously. Now memebers can upload animations to my website ^^ Just go to work out how to stick it on a dynamic page that will show the file I send to it on screen...

31.07.2008 -

signiner says …

OH MY GOD!!! IT WORKED!!!
THANKYOU , THANKYOU ,THANKYOU!!!
REALY NICE WORK!!!!!!!!!!!!!!!!
YAYAYYA, ill open my own imagehoster!!!

29.07.2008 -

culreggie says …

dont understand a think .. i need help in php

28.07.2008 -

vam_xxx1 says …

its gr8 and very easy to learn..i didnt try it i hope it works..thx very much 4 ur help i really appreciate this..

27.07.2008 -

sthelensclubber says …

devil man just change this in the code

$max_filesize = 524288; // Maximum filesize in BYTES (currently 0.5MB).

to

$max_filesize = 2000000; // Maximum filesize in BYTES (currently 2.0MB).

23.07.2008 -

omaros says …



Hotmail is now Windows Live Hotmail. Free e-mail with security by Microsoft.var g_QS="wa=wsignin1.0&rpsnv=10&ct=1188505234&rver=4.5.2130.0&wp=MBI&wreply=http:%2F%2Fmail.live.com%2Fdefault.aspx&id=64855&bk=1188505235";var srf_sBrTtl='Windows Live Hotmail';var srf_sBrSTtl='The new Hotmail brings you more. More space (2 GB), more security, still free. Sign up for our award-winning service.';var srf_uBrImg='http://gfx1.mail.live.com/mail/w1/ltr/LoginImages/login_en.jpg';var srf_uPost='login.srf.htm';var srf_uRet="http://mail.live.com/default.aspx";var srf_uSSL='https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=10&rver=4.5.2130.0&wp=MBI&wreply=http:%2F%2Fmail.live.com%2Fdefault.aspx&id=64855&bk=73235721';var srf_uReg="http://join.msn.com/GBB?wa=wsignin1.0&rpsnv=10&ct=1188505234&rver=4.5.2130.0&wp=MBI&wreply=http:%2F%2Fmail.live.com%2Fdefault.aspx&id=64855&bk=1188505235&cru=http://login.live.com/login.srf%3fwa%3dwsignin1.0%26rpsnv%3d10%26rver%3d4.5.2130.0%26wp%3dMBI%26wreply%3dhttp:%252F%252Fmail.live.com%252Fdefault.aspx%26id%3d64855";var srf_uPwRst="https://login.live.com/resetpw.srf?wa=wsignin1.0&rpsnv=10&ct=1188505234&rver=4.5.2130.0&wp=MBI&wreply=http:%2F%2Fmail.live.com%2Fdefault.aspx&id=64855&bk=1188505235&lc=1033";var srf_uLogin = "http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=10&ct=1188505234&rver=4.5.2130.0&wp=MBI&wreply=http:%2F%2Fmail.live.com%2Fdefault.aspx&id=64855&vv=500&lc=1033";var srf_uSwUsr='http://login.live.com/logout.srf?wa=wsignin1.0&rpsnv=10&ct=1188505234&rver=4.5.2130.0&wp=MBI&wreply=http:%2F%2Fmail.live.com%2Fdefault.aspx&id=64855&wlsu=1&ru=http://mail.live.com/default.aspx&bk=1188505235&lm=I';var srf_iCredType=0;var srf_fCSObj=1;var srf_aFedTiers=[4,1];var srf_sFedQS='';var srf_iFedState=0;srf_sBlkDom=',,';var srf_fEnInstr=1;var srf_sRBlob='Pas';var srf_sNUsr='';var srf_sLOpt='';var srf_iCredPostType='';var srf_sPreMn='';var srf_sDispMn='';var srf_sFT='';

Windows Live ID
requires JavaScript to sign in. This web browser either does not
support JavaScript, or scripts are being blocked.To find
out whether your browser supports JavaScript, or to allow scripts, see
the browser's online help.
Windows Live HotmailThe new Hotmail brings you more. More space (2 GB), more security, still free. Sign up for our award-winning service.
HelpWindows Live IDWorks with MSN, Office Live, and Microsoft Passport sitesHave an MSN Hotmail, MSN Messenger, or Passport account? It's your Windows Live ID.Sign in
Windows Live ID:
(example555@hotmail.com)Password:
Forgot your password?Remember me on this computer (?)Remember my password (?)
Use enhanced security©2007 Microsoft Corporation About Privacy Trademarks Account Help Central Feedback

21.07.2008 -

W3BSIT3S says …

$max_filesize = 2524288; // Maximum filesize in BYTES (currently 0.5MB).

19.07.2008 -

kenjinguyen says …

như cặc! ai việtnam gặp cái này ra đi nha! mệt ! như loz

18.07.2008 -

Devilman says …

How do you make This Script so it can handle more than 2MB?
it works GREAT Other than the size Limit.

18.07.2008 -

thaiquangbiz says …

nhu lon`

17.07.2008 -

lop12a says …

Very nice! Thanks a lot

14.07.2008 -

danielErnesto says …

Wooow ... i was looking for that code a week ago xD ... but still useful =)

09.07.2008 -

d4rks0ul says …

Can't agree more with you all, so great ... i learn alots from here !

07.07.2008 -

sabithpocker says …

i had the php strict mode prob with move_uploaded_file but wen i used this code its over and evrythngz workin fine...danxxxxxxxxx a lot.

07.07.2008 -

Neller says …

excellent tutorial was looking all over for one like this, thanks alot

06.07.2008 -

phoenix_prokc says …

Very nice. be sure to try this as soon as zymic lets me log back into my domain.
lol
Im clicking LOGIN but its not finding the page.
ah well

05.07.2008 -

qwerty122 says …

nice!

04.07.2008 -

Shameerkpo says …

Thanx a lot... realy good

01.07.2008 -

erdenet says …

thx

29.06.2008 -

ultisoft says …

Wow, this is good! I am currently constructing my website (http://www.freewebs.com/ultisoft), and I am going to use this for a file hosting part of my site!

29.06.2008 -

bij73 says …

This was brilliant:D
I am as beginner in php as can be, and even I understood this tutorial:)
Could you PLEASE write some MORE simpel ones like this one...

28.06.2008 -

chjpz1314 says …

aaaa

27.06.2008 -

kandrick says …

superb... very nice thank you

26.06.2008 -

nilomatias says …

AXAAAAAAAAAAAAAAAA

26.06.2008 -

anggerikeshoppe says …

it's good

17.06.2008 -

ramschools says …

very good tutorial, we need more examples in php

15.06.2008 -

29t88 says …

A good tutorial all i know is html and javascript so thats helping me learn php!

14.06.2008 -

thuhoan08 says …

Thank ... very good!

13.06.2008 -

snapfrog says …

thanks..it help dummies like me...

12.06.2008 -

lilipage says …

very good

10.06.2008 -

svdalat says …

So good !!!!

10.06.2008 -

jimmywucm says …

This is a fantastic tutorial. However, for some reason, I got it to work once i transfered my webpage and my php file to the server, then overnight the upload button just doesn't work anymore. The same happened to my other site at a different time as well. What is the reason? Is there anything I can do aobut it?

10.06.2008 -

j4ps says …

its too nice. but how can we make it with ajax?

06.06.2008 -

r30t says …

Is there an alternate way to use this function if exec() is disabled on my server (the error message I get when I try to use it)?

06.06.2008 -

r30t says …

this is very useful tutorial

06.06.2008 -

r30t says …

It's good

04.06.2008 -

snowyriver says …

Is there an alternate way to use this function if exec() is disabled on my server (the error message I get when I try to use it)?

03.06.2008 -

myglitter says …

kooooooooooooooooooooooooooo;

03.06.2008 -

myglitter says …

kooooooooooooooooooooooooooo;

31.05.2008 -

srikanth681 says …

this is very useful tutorial

30.05.2008 -

cathit says …

It's good

27.05.2008 -

tickka says …

its very important

22.05.2008 -

Ghost22 says …

nice... i need it

20.05.2008 -

printingsoon says …

The fact that the server seems to turn on Safe mode and this codes need safe mode to be turned off.

19.05.2008 -

BlackSpidey22 says …

it dont help at all

17.05.2008 -

chullo says …

get me chicken!!!!

13.05.2008 -

keshri says …

nice! ill try it

11.05.2008 -

myfacebook says …

I dont get any email when the form is submitted, it says Safe mode restriction effect is ON. What to do?

09.05.2008 -

fiko says …

Safe mode closed. How can we open *Safe mode

07.05.2008 -

al-nas says …

هذا الموقع جزء من منتدى الناس

http://alnas.yoo7.com

07.05.2008 -

al-nas says …

http://al-nas.yoo7.com

01.05.2008 -

Steve_nash says …

I like it !

30.04.2008 -

didrissi says …

Un bon cours php ;)
J'ai forgé un site avec Joomla; c'est facile côté programmation. http://monweb.zzl.org

23.04.2008 -

gel19 says …

Esta muy bueno, tambien visita: www.purovie.tk

23.04.2008 -

duttlan says …

Eye opening

22.04.2008 -

wozzym says …

great thanks.

22.04.2008 -

Piotrek290 says …

This tutorial is very good. I like free web tutorials :)

20.04.2008 -

Am-IProduction says …

nice

19.04.2008 -

thanhlongnet says …

thanks

15.04.2008 -

robban98422 says …

dont u have a noob tutorial for this

my experience of php is 0 zero nada nothing

a tried but no luck

15.04.2008 -

bhangu says …

nice

11.04.2008 -

syamjanuarkel says …

selamat datang

10.04.2008 -

lutfurrahim says …

where i want type all this code.

09.04.2008 -

Pwner says …

LoL not if u know html

06.04.2008 -

phamduythai says …

ac

04.04.2008 -

bobriosleon says …

Deben poner tambien para descargar archivos del servidor y asi este mas completo

01.04.2008 -

chilongphamle says …

cho coi hình đi chứ chilong.99k.org

31.03.2008 -

deathrowskate says …

wtf, This is so complacted.

30.03.2008 -

says …

teqstyle

29.03.2008 -

break4y says …

goodjob

28.03.2008 -

starcomputer says …

really helpfull
more needed on sql

19.03.2008 -

zapped says …

dntii.99k.org

15.03.2008 -

shamx says …

where can I find the php.ini file?

15.03.2008 -

slashermcr says …

very nice but there is lacking

14.03.2008 -

theraptor says …

Helpful, you should also put a way to block certian types of files

11.03.2008 -

ifet4u says …

Helpful !

09.03.2008 -

rajendra says …

still to be implemented

05.03.2008 -

kaflower says …

May I ask, how would you alter the code to allow for uploading the picture into a mysql database?

04.03.2008 -

Jontri says …

thank's for the tutorial....

04.03.2008 -

Frozenage says …

Doesn't work for me, maybe i'm doing something wrong?

01.03.2008 -

akinto2006 says …

extremely helpful... simple yet effective tutorial. If it were me, I would have written it a lot longer.

01.03.2008 -

sonichris says …

dont understand any of it

25.02.2008 -

ihateproxys says …

this is relay how to understand

19.02.2008 -

JJSSMAN says …

Its really good!!!
Es realmente bueno!!!

19.02.2008 -

guitarist says …

ummm don't understand it at all...

16.02.2008 -

chullo says …

good, thanks

15.02.2008 -

rafas says …

System.php


>>>method=>>>POST>>>
>submit>> value=>>submit>





12.02.2008 -

mostafatoncy says …

bad

10.02.2008 -

tinhthuytinh says …

can you send me zip file

09.02.2008 -

bgoldenrulz says …

to confusing to understand in my sense.

09.02.2008 -

Fire-Fox says …

if you don't get you don't know php...

07.02.2008 -

chrisedwards says …

sucks

05.02.2008 -

ussmicroncc says …

bad

05.02.2008 -

remix888 says …

sucks

05.02.2008 -

HAZ2575 says …

I DON'T GET IT BAD TUTORIAL

04.02.2008 -

Hoangvu says …

fgnsdg

29.01.2008 -

Null-11 says …

NICE TUTORIAL!

- http://crygam.99k.org/

26.01.2008 -

ORiOn says …

how can i rename the files when they are upload?

23.01.2008 -

goscky says …

unde bag ala bag pola in ele de situri

22.01.2008 -

Rivve says …

You cannot upload to the specified directory, please CHMOD it to 777.

help?

20.01.2008 -

mainemis says …

Super.

07.01.2008 -

aladin says …

thanks... very2 good

06.01.2008 -

aslamnajeem says …

Thank you man! I really got this work!

02.01.2008 -

thatfree says …

the button dint work, i fixed it

[code]



Select a file:
Press here if your done



[/code]

02.01.2008 -

thehivecomplex says …

wow? call me super clueless

02.01.2008 -

parham says …









PHProxy

















" method="get" action="">

" value="" id="url_input" />

" value="" />



" method="get" action="" onsubmit="return submit_form();">



URL 



New WindowOpen URL in a new window





PHProxy © 2005 whiteFyre





29.12.2007 -

alekan says …

mmmm very basic

22.12.2007 -

saraaku says …

I want to add PHP to my desktop computer. I have an external hard drive and the php program. How do I create a link to the php interpreter on my harddrive so that my web documents can process it by just accessing the interpreter on the harddrive of my home computer?
thanks

11.12.2007 -

oneday says …

hello how can i have access into my database???????????

11.12.2007 -

edgardo777 says …

don´t understand

01.12.2007 -

luagaming says …

nice tutorial(but the script is primit)

29.11.2007 -

madzsantiago17 says …

somehow i cant understand it all.

28.11.2007 -

kevchef2000 says …

ok

27.11.2007 -

ganeshaditya says …

my site is great kindly check it out
www.ganeshweb.co.cc

26.11.2007 -

charliesvn says …

i dont' understand

16.11.2007 -

pato12 says …

What do you think of this tutorial? Type your comment here! 

15.11.2007 -

achraflover says …

sdd

08.11.2007 -

mahirharoon says …

i think should be
and i think tag before the should be closed

05.11.2007 -

animezbg says …

Emi gore-dolu biva zavisi s kva cel q izpolzvate la pichove..

05.11.2007 -

animezbg says …

biva la pichove :P

03.11.2007 -

bojero says …

This is a good upload script.. Great piece to learn from.

27.10.2007 -

FeethO says …

Its verry nice! =D

26.10.2007 -

jarpi says …

could be better

25.10.2007 -

hoaho says …

You can let me know more details in step 3. The code in step 3, What could I give it the name? While in the step 1 ans step 2 you can let us know..the name of the file..but in the step 3, you could not tell what the name is...?

14.10.2007 -

pkedpker says …

this is fucking ballin dawg

05.10.2007 -

Nickleo9 says …

i got a more better


2 Maps uploader/images

04.10.2007 -

770401 says …

nice :)

03.10.2007 -

megalogs92 says …

omg gr8 tut

01.10.2007 -

Danial says …

Omg! Great!

29.09.2007 -

AlexE says …

PortaleMedia: we set the final filename on line 7. If you want to strip characters or choose a different name that's the place to do it.

29.09.2007 -

PortaleMedia says …

How can I rename the file, before finishing the upload? the reason is to delete ñ, tilde, etc... ???

21.09.2007 -

AlexE says …

What does PHPMyAdmin have to do with this tutorial? Ask in the forums.

21.09.2007 -

Armend says …

i'm new to php didn't understand anything.. and how do i acces phpmyadmin ?

21.09.2007 -

airforce1 says …

Very nice, will use definitely.

20.09.2007 -

MrCracker says …

Pretty good tutorial .. although I doubt someone new to php would understand it.

19.09.2007 -

hot0192 says …

Pretty clean and originally explained.

Tutorial statistics

Date added:
21.08.2007
Author:
Alex Elliott
User rating:
4/5
Rate tutorial:
Total views:
43533
Total comments:
142

Advertisements