From: klas dot wirholm at gmail dot com
Operating system: Arch Linux
PHP version: 5.2.6
PHP Bug Type: *Directory/Filesystem functions
Bug description: $_FILES['upload']['size'] sometimes return zero and sometimes
the fielsize
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 bug report at http://bugs.php.net/?id=45124&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45124&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45124&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45124&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45124&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45124&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45124&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45124&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45124&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45124&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45124&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45124&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45124&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45124&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45124&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45124&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45124&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45124&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45124&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45124&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45124&r=mysqlcfg