note 104349 added to features.file-upload.post-method
| From: | AgeBosma at osu1 dot php dot net | Date: | Fri, 10 Jun 2011 09:49:38 +0000 |
| Subject: | note 104349 added to features.file-upload.post-method | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180397@lists.php.net to get a copy of this message | ||
"If no file is selected for upload in your form, PHP will return
$_FILES['userfile']['size'] as 0, and
$_FILES['userfile']['tmp_name'] as none."
Note that the situation above is the same when a file exceeding the MAX_FILE_SIZE hidden field is
being uploaded. In this case $_FILES['userfile']['size'] is also set to 0, and
$_FILES['userfile']['tmp_name'] is also empty. The difference would only be the
error code.
Simply checking for these two conditions and assuming no file upload has been attempted is
incorrect.
Instead, check if $_FILES['userfile']['name'] is set or not. If it is, a file
upload has at least been attempted (a failed attempt or not). If it is not set, no attempt has been
made.
----
Server IP: 69.147.83.197
Probable Submitter: 92.70.188.98
----
Manual Page -- http://www.php.net/manual/en/features.file-upload.post-method.php
Edit -- https://master.php.net/note/edit/104349
Del: integrated -- https://master.php.net/note/delete/104349/integrated
Del: useless -- https://master.php.net/note/delete/104349/useless
Del: bad code -- https://master.php.net/note/delete/104349/bad+code
Del: spam -- https://master.php.net/note/delete/104349/spam
Del: non-english -- https://master.php.net/note/delete/104349/non-english
Del: in docs -- https://master.php.net/note/delete/104349/in+docs
Del: other reasons-- https://master.php.net/note/delete/104349
Reject -- https://master.php.net/note/reject/104349
Search -- https://master.php.net/manage/user-notes.php