PHP Classes

upload multiple images to etsy

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  PHP OAuth Tutorial on...  >  All threads  >  upload multiple images to etsy  >  (Un) Subscribe thread alerts  
Subject:upload multiple images to etsy
Summary:only able to upload one image
Messages:6
Author:Wong Gar Kit
Date:2015-12-03 09:21:53
 

  1. upload multiple images to etsy   Reply   Report abuse  
Picture of Wong Gar Kit Wong Gar Kit - 2015-12-03 09:21:53
Dear Manuel Lemos,

i've refered to below post to upload photo to etsy:
phpclasses.org/discuss/blog/Package ...

it works fine.
however when i tried to upload multiple images, only one image is being uploaded.



$success = $client->CallAPI(
$etsy_str_update, 'POST', array(
'image' => '../media/catalog/product/4/5/450-019-800x800.jpg',
'image' => '../media/catalog/product/4/5/450-010-800x800.jpg'
), array('FailOnAccessError'=>true,
'Files'=>array(
'image'=>array(
)
)), $upload);




i knew there's something need to do with this array:
array(
'image' => '../media/catalog/product/4/5/450-019-800x800.jpg',
'image' => '../media/catalog/product/4/5/450-010-800x800.jpg'
)

Can you please help me on this? Thank you so much.

  2. Re: upload multiple images to etsy   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-12-03 17:35:48 - In reply to message 1 from Wong Gar Kit
You cannot have two request variables with the same name because one will override the other.

In general you can assign an array to the variable but that depends on what the API expect.

What API are you using?

  3. Re: upload multiple images to etsy   Reply   Report abuse  
Picture of Wong Gar Kit Wong Gar Kit - 2015-12-14 01:47:39 - In reply to message 2 from Manuel Lemos
Dear Manuel Lemos,

i've solved the problem by using loop to push multiple images to etsy. it's working fine now.
but i have another problem where im not able to pass multiple line of product description to etsy via API.

for example i pass <br>, <br/>, \n, \r\n, PHP_EOL, newline etc...
but it will be printed as text or an underscore, _.
do you know how to pass line break to ETSY for listing description? Thank you so much.

  4. Re: upload multiple images to etsy   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-12-14 03:54:09 - In reply to message 3 from Wong Gar Kit
I have no idea. Can you show the code you are using to submit the description?

  5. Re: upload multiple images to etsy   Reply   Report abuse  
Picture of Wong Gar Kit Wong Gar Kit - 2015-12-15 08:09:22 - In reply to message 4 from Manuel Lemos
$description = 'This is line 1' . PHP_EOL .
'This is line 2' . PHP_EOL .
'This is line 3<br>This is line 1<br>This is line 2<br>This is line 3"\r\n" testing test test';

$etsy_str_update = 'https://openapi.etsy.com/v2/listings';
$etsy_str_update .= '?title=';
$etsy_str_update .= 'test';
$etsy_str_update .= '&quantity=';
$etsy_str_update .= 1;
$etsy_str_update .= '&price=';
$etsy_str_update .= 5;
$etsy_str_update .= '&description=';
$etsy_str_update .= $description;
$etsy_str_update .= '&who_made=someone_else&state=draft&is_supply=true&when_made=2010_2015&shipping_template_id=13';

$success = $client->CallAPI(

$etsy_str_update,
'POST', array(), array('FailOnAccessError'=>true), $user);

  6. Re: upload multiple images to etsy   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-12-15 18:02:28 - In reply to message 5 from Wong Gar Kit
If the API expects the description in the URL, you need to use the URLEncode() function to encode the value passed to the URL or else it will be invalid.