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;
		}
Member Avatar for Zagga

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.