Ultrashock Forums > Development > Server Side
[php] Uploading Files

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
[PHP] Upload File
Old 2007-01-30

What exactly does putting enctype="multipart/form-data" in the form tag do? I know that you must have it to make a file upload form work, but why?
postbit arrow 4 comments | 177 views postbit arrow Reply: with Quote   
Registered User
Secret is offline
seperator
Posts: 140
2004-09-25
Secret lives in United States
Secret's Avatar
seperator

Ultrashock Member Comments:
Jeff Jeff is offline Moderator Jeff lives in United States 2007-01-30 #2 Old  
It tells your browser to encode the POST data as multipart/form-data, which is code for 'there's a couple parts, and one of them may be something besides a simple text field, so encode it accordingly'.

Without that, you'd get it sent as a URL-encoded list of variable/value pairs (&var=value), which makes transferring a file kinda tough...
Reply With Quote  
Silver_S's Avatar Silver_S Silver_S is offline Silver_S lives in Argentina 2007-01-31 #3 Old  
enctype="multipart/form-data" let you upload files with PHP, like JPG files, DOC files, etc......
Reply With Quote  
tiran tiran is offline tiran lives in United States 2007-01-31 #4 Old  
I can't tell you how many times I have forgot to put that and banged my head against the wall for 15 - 20 mins before I realized the omission.
Reply With Quote  
Secret's Avatar Secret Secret is offline Secret lives in United States 2007-01-31 #5 Old  
^ Same here....
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: