Jump to content

Upload images using webservice


Bemasoft

Recommended Posts

Please, could anyone explain me how to upload an image using webservice?

I'm able to create, edit and delete products but I can't figure out how to upload images and linking them to a concrete product.

Thank you so much.

Link to comment
Share on other sites

  • 4 weeks later...

Hi Bemasoft,

Thanks for your reply.
I checked your post (translated by Google ;-)).

I have a question about it.
If I use CURL to generate the request (like with the Webservice CRUD tutorial), where must I put the content of the image.
I've added CURLOPT_POSTFIELDS => 'name="image"&filename;="50.jpg"', used the url 'images/products/9' for an existing product id,
but I can't found how to add the content to the request.
I get the content with PHP like this :

$image = file_get_contents('50.jpg');



Muchas gracias. ;-)

Damien

Link to comment
Share on other sites

Hi,

I think I've figured it out.
I put this in the CURL request and it works :

CURLOPT_POSTFIELDS => array('image' => '@'.$image.';type=image/jpeg')


where $image is this absolute path to the image.

Thanks for your help.

PS : maybe you could mark this topic as solved.

Damien

Link to comment
Share on other sites

  • 8 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...