0

Hey guys,

I'm trying to make a check to see if a file to be uploaded was added. I have tried the below and a few variations. I imagine I'm having problems because $_FILES is a global variable and is therefore always set. But I still can't figure out what to do instead. Any help would be great.

if (!isset($_FILES['file'])){
			$err = $err + 64;
		}
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Zagga
0

Hi peck3277,

Try using

if (file_exists($path_to_file)){
   echo "The file exists";
}

obviously setting $path_to_file to the location of the file.


Hope this helps
Zagga

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.