| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Goodbye little old lady
|
iupload file with contact form
I've been taske with building a contact form that allows the user to upload a file (a .doc or .pdf - nothing huge). UNfortunately my php is rubbish and I have a hangover. Anyone able to point me in the right direction? |
|
|
|
|
|
#2 (permalink) |
|
Registered User
Join Date: Oct 2006
Location: London, UK
Posts: 29
|
Within the contact form you'll need a file input box. <input type="file" name="newfile"> Then you will need to use the php to get information on the file, validate it and move it to the directory of your choice. That or email it to an email address, which is a whole other ball game. On the php.net site, look up "move_uploaded_file" for moving the file somewhere. The file information is stored in an array $_FILES and, so in my example $_FILES['newfile']['name'] would be the name of the file uploaded. Also remember to add ' enctype="multipart/form-data" ' to your form tag of the file won't be uploaded. |
|
![]() |