|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33673 File upload error reporting partial uploads incorrectly
Submitted: 2005-07-13 01:12 UTC Modified: 2005-07-13 22:48 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jason at code820 dot com Assigned:
Status: Closed Package: HTTP related
PHP Version: 5CVS, 4CVS (2005-07-13) OS: *
Private report: No CVE-ID: None
 [2005-07-13 01:12 UTC] jason at code820 dot com
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:

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
$m = print_r($_FILE, TRUE);
mail("", "DEBUG", $m);

Mail message contains:
    [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:
    [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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-13 19:51 UTC]
This is really a bug, or rather a mixed up error:

We actually don't have an error for partial uploads at the moment.

 [2005-07-13 19:56 UTC] jason at burfield dot com
Ok...can the docs be updated for this? Might save someone a lot of time in the future.

Also...will future versions of PHP support partial upload detetction?

 [2005-07-13 22:48 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Mar 02 14:01:34 2024 UTC