Question : $_FILES Question

I have been doing file uploads for some time and haven't had a problem. Now I am trying to add  to my code and only perform something if the user is attempting to upload a file.  I have been trying to use if (isset($_FILES[$file_name]))  which doesn't seem to work.  It is ending up true whether they are uploading a file or not.  What is the best way to check the file field in a form to see if it has a value in it?   I know it is an array and have read where "isset" doesn't work for arrays. However, I found this code used with file uploads in the books I have.  Thanks!

Answer : $_FILES Question

This is better
1:
2:
3:
if(basename($_FILES['name_of_input_field']['name']) != ''){
//all your php upload script goes here
}
Random Solutions  
 
programming4us programming4us