Adding upload to a form?

setabkcin

New Member
I have a form already built with php includes and such and all submissions are being sent to a specific email. All the fields are text fields. I need to allow uploads of photos and/or mp3 files to the form. I need them to send with all the form data. How do I add a field for an upload? Also, can I restrict it to certain file types and can I make it a required field? Thanks for the help.
 

Phidev

New Member
there is an input type called "file"

in php you will access it with the $_FILE variable.
so in your form you will add something like

<input type="file" name="media" />

and in the php side you can access it with

<?
echo "<pre>";
print_r($_FILES['media'])
echo "</pre>";
?>

You may want to read the php manual to get the hang of it.

and to prevent uploading different file times then you will need to do some parsing with the file name, and compare the extension
 
Top