php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24404 File Upload Failure
Submitted: 2003-06-30 07:12 UTC Modified: 2003-07-04 18:49 UTC
From: catalin at ips-software dot de Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.1 OS: Linux (mandrake 9.0)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: catalin at ips-software dot de
New email:
PHP Version: OS:

 

 [2003-06-30 07:12 UTC] catalin at ips-software dot de
Description:
------------
   Trying to upload files which exceed the post_max_size param from php.ini fails without any errors transmitted to the PHP script that handles the upload. This is the logged error.
   [error] PHP Warning:  POST Content-Length of 11184886 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
    I did specify MAX_FILE_SIZE in the HTML form, before the
<Input type=file ... block.
    The engine discards the download and gives no error.
The $_FILES and any other server vars are completely empty; no error about the broken upload.

php.ini:
memory_limit = 48M 
post_max_size = 8M 
file_uploads = On 
upload_max_filesize = 8M 
allow_url_fopen = On 


Reproduce code:
---------------
<FORM name='up' enctype='multipart/form-data' method='POST' action='<?php echo $PHP_SELF ?>'>
<INPUT type='hidden' name='MAX_FILE_SIZE' value='5242880' />
<INPUT type='file' name='up_file' size='50' />
<INPUT type='submit' name='submit' />
</FORM>

<?php
  if(!empty($submit)) {
    print_r($_FILES);
    phpinfo();
  }
?>

Expected result:
----------------
   Since I tryied to upload a file which exceeds both the MAX_FILE_SIZE and the post_max_size I would have expected to find some sort of error in the $_FILES['up_file']['error'] or anywhere else in the PHP variables, but
I found no such error(s).

Actual result:
--------------
    No result whatsoever except the log:
[error] PHP Warning:  POST Content-Length of 11184886 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-30 07:14 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Fix your php.ini settings, \"post_max_size\" and \"upload_max_filesize\" for example.
 [2003-07-04 18:49 UTC] cynic@php.net
there seem to be two problems here:

* PHP does not signal the condition to the running script in any way. you just get empty $_FILES/$_POST arrays

* the warning is not displayed, only logged, ignoring the display_errors php.ini setting. all you can do is enable track_errors and parse the $php_errormsg variable. a bit convoluted if you ask me.

the first item is debatable, the other one sure looks like a bug.
 [2003-08-12 11:10 UTC] moregan at flr dot follett dot com
> PHP does not signal the condition to the
> running script in any way.  you just get
> empty $_FILES/$_POST arrays

The empty $_POST array was an irksome thing to have to work around.  We would appreciate getting a populated $_POST even when the upload exceeds its limit.
 [2010-08-04 20:52 UTC] ryankam at hushmail dot com
Set Post Max like this: post_max_size = 14M and then just handle max file size in 
html and it will catch and throw an error. I dont know why 14m is a magic number 
but after testing in 5.3.3 it seems that is the fix. On winxp machine.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 11:01:32 2025 UTC