I want to use the image upload API. It receives the image file via POST and sends me this URI of the image that I uploaded. but this API is sending me an error. If the content-to-content type is not a mime image type type (e.g. image / jpeg, image / png, ...)
But when I upload the image file via FTP and use CURL as the file upload, it sends me an error message because the Content-Type of this image is always an “application / octet stream”. I want to change this type of mime. Is there any way to change this?
Here is the code:
<?php
$fileUploadPostParams = Array(
"uploadedfile" => "@/files.jpg"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://uix.kr/widget/parameter.php");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fileUploadPostParams);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);
?>
and here is the result:
...
===== file =====
Array
(
[uploadedfile] => Array
(
[name] => 2312.jpg
[type] => application/octet-stream
^^^^ I want to change here...
[tmp_name] => /tmp/php5bigGV
[error] => 0
[size] => 383441
)
)
sorry for bad english .. thanks
source
share