note 20152 added to features.file-upload

From: Date: Sun, 24 Mar 2002 19:14:20 +0000
Subject: note 20152 added to features.file-upload
Groups: php.notes 
Request: Send a blank email to php-notes+get-28149@lists.php.net to get a copy of this message
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!"; -- http://www.php.net/manual/en/features.file-upload.php http://master.php.net/manage/user-notes.php?action=edit+20152 http://master.php.net/manage/user-notes.php?action=delete+20152 http://master.php.net/manage/user-notes.php?action=reject+20152

« previous php.notes (#28149) next »