Forum Moderators: coopster

Message Too Old, No Replies

finding value of a form upload field

         

stef25

5:00 pm on Jul 20, 2007 (gmt 0)

10+ Year Member



i have a page that allows people to upload up to 6 images - optionally. the script that handles the upload loops through all 6 form fields but throws an error if they have been left blank. so i want to trigger the upload script only IF the value of the form fields is something (ie a path on their pc). if it has been left blank on submission of the form, the user has not selected an image and the script should not run.

however im not sure how to check the contents of a file field. echo "$_POST['name_of_field]"; shows nothing. do i need to access the value via $_FILES[?] and if so how do i process that array?

thanks ...

willybfriendly

5:09 pm on Jul 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if(isset [us2.php.net]($_POST['name_of_field']))
{
do something;
}

But, better to sanitize post data first abnd assign it to a variable or array element.

stef25

12:24 pm on Jul 23, 2007 (gmt 0)

10+ Year Member



that worked, when I replaced POST with FILES

thanks!