Bug #55450 [Asn]: Built in web server not accepting file uploads
| From: | laruence@php.net | Date: | Fri, 19 Aug 2011 06:37:48 +0000 |
| Subject: | Bug #55450 [Asn]: Built in web server not accepting file uploads | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-162672@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55450&edit=1
ID: 55450
Updated by: laruence@php.net
Reported by: scott at aubrey dot org dot uk
Summary: Built in web server not accepting file uploads
Status: Assigned
Type: Bug
Package: Built-in web server
Operating System: Mac OS X 10.7.1 (Lion )
PHP Version: 5.4.0alpha3
Assigned To: moriyoshi
Block user comment: N
Private report: N
New Comment:
this should due to the following code in sapi/cli/php_cli_server.c 2161 :
php_cli_server_client_populate_request_info:
...
{
char **val;
const char delimiter[] = ";";
if (SUCCESS == zend_hash_find(&client->request.headers, "Content-Type",
sizeof("Content-Type"), (void**)&val)) {
request_info->content_type = strtok(*val, delimiter);
}
}
...
which erased the boundary content of "multipart/form-data; boundary=----****",
Previous Comments:
------------------------------------------------------------------------
[2011-08-18 14:22:03] scott at aubrey dot org dot uk
forgot to add, that I started the server with:
php -nS localhost:8001 -t.
and the server output was:
[Thu Aug 18 15:13:56 2011] ::1:54367 GET /testUpload.php - Request read
[Thu Aug 18 15:13:56 2011] ::1:54367 GET /testUpload.php - Response sent successfully (200)
[Thu Aug 18 15:14:01 2011] ::1:54369 POST /testUpload.php - Request read
[Thu Aug 18 15:14:01 2011] ::1:54369 POST /testUpload.php - Response sent successfully (200)
------------------------------------------------------------------------
[2011-08-18 14:19:47] scott at aubrey dot org dot uk
Description:
------------
The built in web server does not handle file uploads, instead throwing an error.
This is a fairly clean build of alpha 3.
Test script:
---------------
<?php
var_dump($_SERVER);
?>
<form enctype="multipart/form-data" method="post">
<label for="filename">Select a file to upload:</label><br>
<input type="file" id="file" name="file">
<br><br>
<input type="submit" name="action" value="Upload">
</form>
Expected result:
----------------
array(1) { ["file"]=> array(5) { ["name"]=> string(7)
"testupload.txt" ["type"]=>
string(10) "text/plain" ["tmp_name"]=> string(26)
"/private/var/tmp/phpynOZom"
["error"]=> int(0) ["size"]=> int(12) } }
Actual result:
--------------
array(0) { }
--
Error log throws:
PHP Warning: Missing boundary in multipart/form-data POST data in Unknown on
line 0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55450&edit=1