|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-06-06 10:46 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 17:00:01 2025 UTC |
Description: ------------ When using curl upload file, mine type. eg: .mid .mid .mid or .midi should be "audio/midi" not "application/octet-stream" please check below... Reproduce code: --------------- function my_curl($url, $dataflds) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_HEADER, true); curl_setopt ($ch, CURLOPT_POST, true); curl_setopt ($ch, CURLOPT_POSTFIELDS, $dataflds); $result = curl_exec($ch); curl_close($ch); return $result; } $postdata['image_file'] = "@whiteflower.jpg"; $postdata['sound_file'] = "@MusicBox.mid"; echo my_curl("http://abc.com/info.php", $postdata); exit; Expected result: ---------------- _FILES["image_file"] Array ( [name] => whiteflower.jpg [type] => image/jpeg [tmp_name] => /var/tmp/phpwxA1au [error] => 0 [size] => 14546 ) _FILES["sound_file"] Array ( [name] => MusicBox.mid [type] => application/octet-stream [tmp_name] => /var/tmp/phpp2qVwa [error] => 0 [size] => 6569 ) Actual result: -------------- _FILES["image_file"] Array ( [name] => whiteflower.jpg [type] => image/jpeg [tmp_name] => /var/tmp/phpwxA1au [error] => 0 [size] => 14546 ) _FILES["sound_file"] Array ( [name] => MusicBox.mid [type] => audio/midi [tmp_name] => /var/tmp/phpp2qVwa [error] => 0 [size] => 6569 )