if(file_exists($_FILES['uploaded_file']['tmp_name'])) {
// file does exist...
// we can move it now.. or do some more "checking" on it.
} else {
// file doesn't exist...
}
This here (file_exists()) will return a boolean value on whether or not the file DOES exist.
If it's true, and you output this.. it will be equal to one. If it's false, it's "nothing" or 0.
Here is how booleans work... just for reference..
These are considered false
- the boolean FALSE itself
- the integer 0 (zero)
- the float 0.0 (zero)
- the empty string, and the string "0"
- an array with zero elements
- an object with zero member variables (PHP 4 only)
- the special type NULL (including unset variables)
- SimpleXML objects created from empty tags
Every other value is considered true