ID:               31775
 Updated by:       [EMAIL PROTECTED]
 Reported By:      rudolf at softwares dot ch
-Status:           Open
+Status:           Feedback
 Bug Type:         Documentation problem
 Operating System: Windows XP Pro
 PHP Version:      4.3.9
 New Comment:

Are you sure nothing is written to stdout? On the same environment, I
experienced $_POST and $_FILES empty in case of data-size greater than
post_max_size, but everything is written to stdout as usual.

Can you please give us a link to source of fileupload.php?


Previous Comments:
------------------------------------------------------------------------

[2005-03-29 10:32:58] markusg at cants dot no dot spam dot de

PHP also completely truncates the POST request, so you can't even tell
there was one. Perhaps it would be more useful to process the incoming
data up to the point where the post_max_size limit is reached, and then
set a flag the programmer can check for.

------------------------------------------------------------------------

[2005-01-31 11:40:53] rudolf at softwares dot ch

OK, but the documentation does not explain how this fairly common
condition (an uploaded file > post_max_size) can be trapped.

------------------------------------------------------------------------

[2005-01-31 11:27:55] [EMAIL PROTECTED]

The behavior is correct as POST data is received before the request is
run, but upload_max_filesize is checked later.

------------------------------------------------------------------------

[2005-01-31 11:23:53] rudolf at softwares dot ch

Description:
------------
I'm not sure if this is a documentation omission and/or a PHP bug:

I want to limit the size of files that can be uploaded to 8MB. I have
set upload_max_filesize to 8MB and post_max_size to 10MB. memory_limit
is not enabled.

When I upload a 9MB file, then $_FILES['myfile']['error'] is 1, as
documented. When I upload a 14MB file, PHP writes nothing to stdout and
writes the following to syslog:

PHP Warning:  POST Content-Length of 14171720 bytes exceeds the limit
of 10485760 bytes in Unknown on line 0

The documentation doesn't say how PHP reacts when it uploads a file
larger than post_max_size, but I would assume that it should not "give
up," which is the behavior I'm experiencing.

Reproduce code:
---------------
<html>
<body>
<?php
        if ( $_POST['but_submit'] ) {
                printf("Got the submit!! error (%d) size (%d)",
                        $_FILES['the_file']['error'],
                        $_FILES['the_file']['size']);
        }

?>
<form method="post" action="fileupload.php"
enctype="multipart/form-data">
<table class="form" border="0" cellpadding="0" cellspacing="0">
<tr>
        <td>File</td>
        <td>
                <input type="file" name="the_file" />
        </td>
</tr>
<tr>
        <td colspan="2">
                <input type="submit" name="but_submit" value="Submit" />
        </td>
</tr>
</table>
</form>
</body>
</html>

Expected result:
----------------
Unknown, since the documentation doesn't describe how PHP responds when
the size of the uploaded file is greater than post_max_size.

Actual result:
--------------
A PHP warning written to syslog, and nothing written to stdout. See
description above.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31775&edit=1

Reply via email to