php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24694 File upload support does not populate $_FILES, $_POST
Submitted: 2003-07-17 14:34 UTC Modified: 2003-07-27 14:04 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: namejko at topiksolutions dot com Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.3.3RC2-dev OS: Windows NT 5.1 build 2000 (XP)
Private report: No CVE-ID: None
 [2003-07-17 14:34 UTC] namejko at topiksolutions dot com
Description:
------------
This version of PHP appears to not handle file uploads properly.  Code verbatim from the documentation to use the multipart/form-data enctype in POST forms don't actually send the information properly into $_POST or $_FILES.  Instead, the request comes across in $_GET, where it is unusable.  In previous versions of PHP (in this case, tested on 4.0.6) the code works perfectly.  Below are the HTML form code and the PHP code, together in one file.  On 4.3.1, $_POST and $_FILES are empty arrays, whereas they are filled on 4.0.6.

Reproduce code:
---------------
<?php
    print_r($HTTP_POST_VARS);
    print_r($HTTP_GET_VARS);
    print_r($HTTP_POST_FILES);
?>
<form method="post" enctype="multipart/form-data" action="<?=$PHP_SELF?>">
<input type="hidden" name="MAX_FILE_SIZE" value="30000">
File:  <input name="userfile" type="file">
<input type="submit" name="submit" value="submit">
</form>


Expected result:
----------------
This is what is returned under PHP 4.0.6:

Array
(
    [MAX_FILE_SIZE] => 30000
    [submit] => submit
)
Array
(
)
Array
(
    [userfile] => Array
        (
            [name] => Icon7EFDA3AC3.txt
            [type] => application/octet-stream
            [tmp_name] => /tmp/phpEPVaEg
            [size] => 27648
        )

)
...

Actual result:
--------------
This is what is returned by PHP 4.3.1:

Array
(
)
Array
(
    [Content-Disposition:_form-data;_name] => \"MAX_FILE_SIZE\"

30000
-----------------------------7d32f4b280238
Content-Disposition: form-data; name=\"userfile\"; filename=\"C:\\Documents and Settings\\Zawitz\\Application Data\\Microsoft\\Installer\\{7EFDA3AC-8A61-43C0-B023-33866829C816}\\Icon7EFDA3AC3.txt\"
Content-Type: application/octet-stream

MZ?
)
Array
(
)
---

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-21 14:06 UTC] namejko at topiksolutions dot com
That build produces an output of completely blank (empty) arrays.  Even $_POST, $_GET and $_FILES are empty.
 [2003-07-21 14:26 UTC] iliaa@php.net
Is the  file_uploads ini setting enabled on your system?
 [2003-07-21 15:20 UTC] namejko at topiksolutions dot com
Yes, from phpinfo():

file_uploads: On
upload_max_filesize: 2M
upload_temp_dir: c:/dev/temp/ (which does exist)
 [2003-07-21 16:51 UTC] iliaa@php.net
If you specify a valid (existing) upload directory via the upload_temp_dir ini setting does the problem disappear?
 [2003-07-21 17:14 UTC] namejko at topiksolutions dot com
I did supply a valid upload_temp_dir, and even changed the slashes around to backslashes to see if that was the problem, but it wasn't.
 [2003-07-22 10:36 UTC] sniper@php.net
Which webserver are you using? Apache? IIS?

 [2003-07-22 12:24 UTC] namejko at topiksolutions dot com
Apache/1.3.26 (Win32) mod_perl/1.25 mod_ssl/2.8.10 OpenSSL/0.9.6c DAV/1.0.3 Auth NuSphere/1.0.0 running...

It's from PHPEd, by NuSphere.
 [2003-07-24 21:11 UTC] iliaa@php.net
What is your gpc_order setting set to?
 [2003-07-24 22:30 UTC] philip@php.net
s/gpc_order/variables_order
 [2003-07-25 11:39 UTC] namejko at topiksolutions dot com
variables_order: EGPCS
gcp_order: GPC
 [2003-07-27 14:04 UTC] sniper@php.net
Works fine here with Apache 1.3.28. Not PHP bug but some
configuration issue within your server.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC