php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47217 content-type is not set properly
Submitted: 2009-01-26 11:19 UTC Modified: 2009-01-26 15:20 UTC
From: gubp at pisti dot hu Assigned:
Status: Closed Package: cURL related
PHP Version: 5.2.8 OS: FreeBSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gubp at pisti dot hu
New email:
PHP Version: OS:

 

 [2009-01-26 11:19 UTC] 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
        )

)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-26 15:20 UTC] iliaa@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC