note 20152 deleted from features.file-upload by didou

From: Date: Sun, 27 Jul 2003 16:22:08 +0000
Subject: note 20152 deleted from features.file-upload by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-52758@lists.php.net to get a copy of this message
Note Submitter: mail@philipp-louis.de ---- If no file was uploaded, you would probably expect the $userfile variable (or whatever its name is) to be empty. But it isn't. It contains the string "none" instead. I don't know if this is true for all systems and configurations, but the fact that it *might* be the case is reason enough *not* to use things like that in order to check whether a file was uploaded: // This is bad: if($userfile == "") echo "You did not upload any file!"; Instead, you might want to check $userfile_size. But note that this method makes no difference between NO and an EMPTY file: // This is better: if(!$userfile_size) echo "Either you did not upload any file, or you uploaded an empty file!";

« previous php.notes (#52758) next »