From: brianl at stcu dot org Operating system: Win2K PHP version: 4.3.4 PHP Bug Type: cURL related Bug description: CURLOPT_POSTFIELDS does not parse content types for files
Description: ------------ >From the cURL manual: If you want the contents to be read from a file, use <@filename> as contents. When specifying a file, you can also specify the file content type by appending ';type=<mime type>' to the file name. However, specifing MIME types is not currently supported within PHP. Reproduce code: --------------- $ch= curl_init('http://www.example.com/fupl.php'); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_POSTFIELDS, array('field1'=>'1','field2'=>'2','file'=>'@filepath.ext;type=application/xml')); $result= curl_exec($ch); curl_close($ch); Expected result: ---------------- The file should be uploaded with a Content-Type: application/xml header. Actual result: -------------- The entire call fails. -- Edit bug report at http://bugs.php.net/?id=27023&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27023&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27023&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27023&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27023&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27023&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27023&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27023&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27023&r=support Expected behavior: http://bugs.php.net/fix.php?id=27023&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27023&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27023&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27023&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27023&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27023&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27023&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27023&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27023&r=float