From:             jason at code820 dot com
Operating system: Linux
PHP version:      5.0.4
PHP Bug Type:     Scripting Engine problem
Bug description:  File upload error reporting incorrectly

Description:
------------
On file upload $_FILES['userfile']['error'] is expecting to return an
error when a file is only partially uploaded. However, it returns 0
(upload successful) on each try.

We have uploaded everything from 4 meg files to 250 meg files and we
cancel them mid-transfer and we are still getting a 0 returned.

This is very similar to this bug here:

http://bugs.php.net/bug.php?id=19556

Actually, almost the same thing, just with a newer version of PHP.

We have tried with single uploads as well as multiple uploads with the
same results.

Setup is:

PHP 5.0.4
Apache 2.0.54
eAccelerator 0.9.2
(did it with eAccelerator turned ON and turned OFF, same result)

Apache configure:
./configure --enable-mods-shared=all --enable-ssl

PHP configure:
'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-pgsql'
'--with-mysql' '--enable-bcmath' '--with-mcrypt=/usr/local'
'--with-zlib=/usr/' '--with-mime-magic' '--enable-exif'
'--with-curl=/usr/local' '--with-openssl' '--enable-sockets'
'--enable-mbstring' '--enable-sigchild'


php.ini has been altered to accept larger files on upload/post/etc.

Reproduce code:
---------------
// upload form
<form name="myform" method="post" action="<?php echo $_SERVER['PHP_SELF'];
?>" enctype="multipart/form-data">

Image 1: <input type="file" name="THEFILE" size="30">

// end upload form



// process script
<?php
$m = print_r($_FILE, TRUE);
mail("[EMAIL PROTECTED]", "DEBUG", $m);
?>

Mail message contains:
Array
(
    [THEFILE] => Array
        (
            [name] => IMG_0138.JPG
            [type] => image/jpeg
            [tmp_name] => /usr/local/web/tmp/phpmGnzHe
            [error] => 0
            [size] => 3581591
        )

)

Expected result:
----------------
Expect to see [THEFILE][error] = 3



Actual result:
--------------
Array
(
    [THEFILE] => Array
        (
            [name] => IMG_0138.JPG
            [type] => image/jpeg
            [tmp_name] => /usr/local/web/tmp/phpmGnzHe
            [error] => 0
            [size] => 3581591
        )

)

Actual size of the file on the server is 3040870, NOT 3581591

-- 
Edit bug report at http://bugs.php.net/?id=33673&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33673&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33673&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33673&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33673&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33673&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33673&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33673&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33673&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33673&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33673&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33673&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33673&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33673&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33673&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33673&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33673&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33673&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33673&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33673&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33673&r=mysqlcfg

Reply via email to