#45124 [Opn->Fbk]: $_FILES['upload']['size'] sometimes return zero and sometimes the filesize
| From: | jani@php.net | Date: | Sun, 07 Sep 2008 11:26:09 +0000 |
| Subject: | #45124 [Opn->Fbk]: $_FILES['upload']['size'] sometimes return zero and sometimes the filesize | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-128755@lists.php.net to get a copy of this message | ||
ID: 45124
Updated by: jani@php.net
Reported By: klas dot wirholm at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: *General Issues
Operating System: Arch Linux
PHP Version: 5.2.6
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
A fix was just committed which might fix this one too.
Previous Comments:
------------------------------------------------------------------------
[2008-05-29 09:11:53] klas dot wirholm at gmail dot com
Description:
------------
Sometimes when the uploaded file is bigger then MAX_FILE_SIZE (in
script)the return from $_FILES['uploadedfile']['size'] is zero and
sometimes it returns the right value of the file.
I have only tried whith MAX_FILE_SIZE far under what I have set in
php.ini(upload_max_filesize = 2M).
Looks like it depends on how much bigger the file is then
MAX_FILE_SIZE. Cant figure out the exact difference.
(the script I post is also my temporary solution for the problem)
Reproduce code:
---------------
define('MAX_FILE_SIZE', 1048);
...
elseif ($_FILES['uploadedfile']['size'] > MAX_FILE_SIZE or
$_FILES['uploadedfile']['size'] <= 0) {
$filesize = number_format($_FILES['uploadedfile']['size']/1024,
1).'KB';
$uploadinfo = "<b>The image/file is proberly to bigg</b> (and maybee
then returned zero)!<br /><br/ > We got this filesize from the upload
file: " . $filesize ."<br /> Max acceptable size is " . $maxfs;
}
...
Expected result:
----------------
The exact filesize of the uploaded file (at least if its smaller then
upload_max_filesize set in php.ini).
Actual result:
--------------
Sometimes the exact filesize of the uploaded file, sometimes zero.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45124&edit=1