#41610 [NEW]: Using curl upload *.mid - MIME type is wrong.
| From: | jiawan1234 at yahoo dot com | Date: | Wed, 06 Jun 2007 10:26:34 +0000 |
| Subject: | #41610 [NEW]: Using curl upload *.mid - MIME type is wrong. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-113458@lists.php.net to get a copy of this message | ||
From: jiawan1234 at yahoo dot com
Operating system: All
PHP version: 4.4.7
PHP Bug Type: cURL related
Bug description: Using curl upload *.mid - MIME type is wrong.
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
)
--
Edit bug report at http://bugs.php.net/?id=41610&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41610&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41610&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41610&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41610&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41610&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41610&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41610&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41610&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41610&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41610&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41610&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41610&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41610&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41610&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41610&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41610&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41610&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41610&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41610&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41610&r=mysqlcfg