|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2009-01-26 15:20 UTC] iliaa@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 01:00:01 2025 UTC | 
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 ) )