ID:               26004
 Comment by:       cometfish at hotmail dot com
 Reported By:      jacknorton101 at hotmail dot com
 Status:           No Feedback
 Bug Type:         *General Issues
 Operating System: RedHat Linux 9
 PHP Version:      4.3.3
 New Comment:

Hi, I had this same problem. I spent hours searching the web, but found
nothing except this:
------
from http://www.php.net/manual/en/features.file-upload.php
jason
09-Jan-2006 05:08 
Regarding empty $_FILES and $_POST arrays when uploading files larger
than post_max_size:
Tucked away in
http://us3.php.net/manual/en/ini.core.php#ini.post-max-size is this
nugget:
"If the size of post data is greater than post_max_size, the $_POST and
$_FILES superglobals are empty. This can be tracked in various ways,
e.g. by passing the $_GET variable to the script processing the data,
i.e. <form action="edit.php?processed=1">, and then checking if
$_GET['processed'] is set."
This may seem like a bug. You'd expect something like
UPLOAD_ERR_FORM_SIZE to be set. But you just two empty superglobals.
I've seen it submitted to bugs.php.net twice and it's been marked as
bogus both times. 
--------

I saw this, and realised that my MAX_FILE_SIZE hidden form element was
missing. Inserting this fixed the problem immediately. My PHP version
is 4.4.2. Hope this helps.


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

[2006-05-11 21:24:50] hostgeekz at gmail dot com

I am having this issue on PHP 5.0.4, and PHP 5.1.4

Exactly the same as stated above,
enctype="multipart/form-data"

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

[2006-04-07 08:07:58] timecop at gmail dot com

Yes this is still valid.
whats worse, if enctype=multipart/form-data,
NONE of the variables make it into $_POST.

PHP 5.1.2 / linux

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

[2003-11-03 14:06:54] [EMAIL PROTECTED]

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.



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

[2003-10-27 10:51:37] [EMAIL PROTECTED]

Check your httpd.conf (probably in /etc/httpd/conf) if there's some
directive that limits the maximum length of incoming data.

See bug #22138 for detail

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

[2003-10-27 10:47:18] jacknorton101 at hotmail dot com

Description:
------------
The following code works in my local development environment (Win ME,
Apache 1.3.2, PHP 4.3.2) but not on my host (RedHat 9, Apache 2.0.4,
PHP 4.3.3).
None of the form inputs defined after the <input type="file" size="40"
name="userfile"> line are set in $_POST (all of those appearing before
are). Therefore $_POST['submitimage'] does not get set.
If I take out enctype="multipart/form-data", or replace it with
"multipart/mixed" the $_POST variables are set, but the file is not
available.
The following php.ini directives are identical in both the local and
host environments:
File_Uploads = On
Upload_Max_Filesize = 2M
Upload_Tmp_Dir = (default)
Post_Max_Size = 8M
In my local environment Register_Globals is Off, and the host
environment has them on.

I have searched previous bug reports, and though I have seen similar
problems, they all seem to be closed and rectified some time (over a
year) ago, but my host is on release 4.3.3 - i.e. later than my dev
environment.

Thanks in anticipation, Jack.

Reproduce code:
---------------
....
if(!isset($_POST['submitimage']))
  {....
<form action="<?=$_SERVER['PHP_SELF']?>" enctype="multipart/form-data"
method="post"> 
<input type="text" maxlength="60" size="40" name="caption">
<input type="file" size="40" name="userfile">
<input type="hidden" name="MAX_FILE_SIZE" value="2000000"> 
<input type="submit" name="submitimage" value="Submit">
<input type="reset" value="Reset">
<input type="button" onClick="window.close();" name="noaction"
value="No Action">
</form>
....
<?php
  }
elseif('Submit'==$_POST['submitimage'])
  { //process file ....


Expected result:
----------------
I would expect the $_POST variables to be set, for example
$_POST['submitimage'] should be set and allow the elseif clause to
execute.

Actual result:
--------------
Only the $_POST variables defined in lines above the line:
<input type="file" size="40" name="userfile"> get set. The ones below,
including $_POST['submitimage'] do not get set.


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


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

Reply via email to