|
![Picture of Greg Davault Picture of Greg Davault](/graphics/unknown.gif) Greg Davault - 2015-05-10 17:24:57
Does this api handle uploading images. The required code includes headers. Did not know if I need to work on my own oath call or not. The below code returns: "The_image_array_metadata_doesn't_look_like_a__FILES_array."
Heres the code:
$header = array();
$header["Content-length"] = filesize($path);
$header["Content-Type"] = 'multipart/form-data';
$success1 = $client->CallAPI("https://openapi.etsy.com/v2/listings/232851898/images",'POST', $image, $header, $return);
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2015-05-10 19:48:44 - In reply to message 1 from Greg Davault
Yes, you need to use the Files parameter to tell which values are files to upload. Take a look at the login_with_twitter.php example script.
phpclasses.org/package/7700-PHP-Aut ...
![Picture of Greg Davault Picture of Greg Davault](/graphics/unknown.gif) Greg Davault - 2015-05-10 21:47:53 - In reply to message 2 from Manuel Lemos
Cool...but I am having some problem. Here is my callapi:
"https://openapi.etsy.com/v2/listings/232851898/images",
'POST', $image, array('FailOnAccessError'=>true,'Files'=>array($image['image']=>array
())), $return);
Here is the error message:
it was not specified a file parameter named E:\wamp\Images\BasePics\0416141216_1.jpg;type=image/jpeg
Etsy wants me to add the mimetype to the end of their 'image' parameter. I am guessing that it causes a problem here?
![Picture of Greg Davault Picture of Greg Davault](/graphics/unknown.gif) Greg Davault - 2015-05-10 22:17:35 - In reply to message 2 from Manuel Lemos
I removed the mimetype, but still got this error message:
it was not specified a file parameter named E:\wamp\Images\BasePics\0416141216_1.jpg
![Picture of Greg Davault Picture of Greg Davault](/graphics/unknown.gif) Greg Davault - 2015-05-10 23:27:42 - In reply to message 2 from Manuel Lemos
OK its working. Had to remove the mimetype and configured the callapi as follows:
"https://openapi.etsy.com/v2/listings/232851898/images",
'POST', $image, array('FailOnAccessError'=>true,'Files'=>array('image'=>array())), $return);
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2015-05-11 03:53:15 - In reply to message 3 from Greg Davault
Yes, the file path must not include the MIME type or anything else. Your Files array should be used to pass the MIME type of the file is necessary using a entry name ContentType.
$success = $client->CallAPI(
"https://api.twitter.com/1.1/statuses/update_with_media.json",
'POST', array(
'image'=>$image['image']
),array(
'FailOnAccessError'=>true,
'Files'=>array(
'image'=>array(
'ContentType'=>'image/jpeg'
)
)
), $return);
|