#47217 [Opn->Csd]: content-type is not set properly
| From: | iliaa@php.net | Date: | Mon, 26 Jan 2009 15:20:19 +0000 |
| Subject: | #47217 [Opn->Csd]: content-type is not set properly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-133223@lists.php.net to get a copy of this message | ||
ID: 47217
Updated by: iliaa@php.net
Reported By: gubp at pisti dot hu
-Status: Open
+Status: Closed
Bug Type: cURL related
Operating System: FreeBSD
PHP Version: 5.2.8
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2009-01-26 11:19:59] gubp at pisti dot hu
Description:
------------
Using the cURL to send files with custom content-type (eg.:
"@filename;type=content-type") does not work, because undesirable
"type=" string is preprended to the actual content-type.
Reproduce code:
---------------
test.php:
---------
$data = array('file' => '@sheet.xls;type=application/vnd.ms-excel');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/upload.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec($ch);
echo curl_error($ch);
upload.php:
-----------
print_r($_FILES);
Expected result:
----------------
Array
(
[file] => Array
(
[name] => sheet.xls
[type] => application/vnd.ms-excel
[tmp_name] => /var/tmp/php21KVfg
[error] => 0
[size] => 1192
)
)
Actual result:
--------------
Array
(
[file] => Array
(
[name] => sheet.xls
[type] => type=application/vnd.ms-excel
[tmp_name] => /var/tmp/php21KVfg
[error] => 0
[size] => 1192
)
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47217&edit=1