Bug #62536 [Opn]: file uploads MAX_FILE_SIZE doesn't work as described
| From: | danny at tibibi dot com | Date: | Thu, 12 Jul 2012 17:15:01 +0000 |
| Subject: | Bug #62536 [Opn]: file uploads MAX_FILE_SIZE doesn't work as described | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-171905@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62536&edit=1
ID: 62536
User updated by: danny at tibibi dot com
Reported by: danny at tibibi dot com
Summary: file uploads MAX_FILE_SIZE doesn't work as described
Status: Open
Type: Bug
Package: Unknown/Other Function
Operating System: Windows Server 2008
PHP Version: 5.4.4
Block user comment: N
Private report: N
New Comment:
Thanks for your comment.
If php doesn't do anything with the variable, then why is it php returns error "2" in
the $_FILES array when I set that variable, and upload a file that is smaller than the
max_upload_size in the .ini file but larger than the MAX_FILE_SIZE variable I post?
Previous Comments:
------------------------------------------------------------------------
[2012-07-12 13:57:07] Sjon at hortensius dot net
This feature is meant for clients (eg. browsers), but it seems your browser
doesn't implement this feature. PHP doesn't do anything with this variable
More info @
http://stackoverflow.com/questions/1381364/max-file-size-in-php-whats-the-point
------------------------------------------------------------------------
[2012-07-11 17:10:07] danny at tibibi dot com
Description:
------------
The documentation for handling file uploads, http://us3.php.net/manual/en/features.file-upload.post-method.php
states that when declaring a hidden field named MAX_FILE_SIZE, if the file submitted is larger, then
the user will not have to wait longer to be told that the file was too large.
<?php
if (isset($_POST['MAX_FILE_SIZE']))
{
echo $_FILES['file1']['error'];
}
?>
<html>
<body>
<form action="/test.php" method="post"
enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="100" />
<input type="file" name="file1">
<input type="submit" value="submit">
</form>
</body>
</html>
Actual result:
--------------
The complete file gets uploaded however big it is, and the result shows: 2
This confirms that MAX_FILE_SIZE worked, and the file was too large, but it did not stop processing
the request after 100 bytes were processed.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62536&edit=1