Old 19-10-2006, 18:15   #1 (permalink)
chris_bcn
Goodbye little old lady
 
chris_bcn's Avatar
 
Join Date: Jun 2005
Location: Geordie in SF
Posts: 340
Send a message via MSN to chris_bcn
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?
  Reply With Quote
Old 20-10-2006, 05:09   #2 (permalink)
IdealWebsites
Registered User
 
IdealWebsites's Avatar
 
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.
  Reply With Quote
Old 20-10-2006, 10:41   #3 (permalink)
chris_bcn
Goodbye little old lady
 
chris_bcn's Avatar
 
Join Date: Jun 2005
Location: Geordie in SF
Posts: 340
Send a message via MSN to chris_bcn
cheers - I'll check that out
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8