Error when I try to add an image web service prestashop

Pepe T

I'm trying to add an image to a product using web services, but everytime I try, I get an error. In almost all the pages I have searched this is the code they gave me:

    $key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'; //WebService Key
    $url = 'https://192.168.1.124/prestashop/api/images/products/2';
    $imagen = 'C:\\camisa.png';


    $curl = curl_init();
    curl_setopt($curl,CURLOPT_URL,$url);
    curl_setopt($curl,CURLOPT_POST,true);

    //curl_setopt($ch, CURLOPT_PUT, true); // Un-commet to edit an image

    curl_setopt($curl,CURLOPT_USERPWD,$key.':');
    curl_setopt($curl,CURLOPT_POSTFIELDS,array('image' => '@'.$imagen.';type=image/png'));
    curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);

    $result = curl_exec($curl);
    curl_close($curl);
    echo "<h3>Imagen añadida</h3>";

But it always gives me the following error.

Error Translation:

The page 192.168.1.124 doesn't work.

The page 192.168.1.124 can't process this request right now.

Any help will be appreciated. Greetings!

Pepe T

I solved the problem. I named the file 'Añadir Imagen' and it seems that localhost doesn't recognize the 'ñ' character.

Hope that it helps someone with the same problem.

Greetings!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

"Accounts failed to link" error happens when I try to authorize Google Assistant at my Web service

Error 404 when i try to add sharepoint lists.asmx web references

I get the error when i try get 50% of the image with cropperJS

I got error when i try to acces an image folder?

I get error when i try to add value to defaultdict(str)

I am getting following error when I try to add constraint

My app crashes when I try to add Image Button to it

MVC always return me null when I try to add an image

Why I get error when try build image in docker?

Web scraping error when I try to create a request

Error when I try to add a dateTime field to my table

Why does MYSQL error when I try to add a foreign key?

Flutter editor shows an error when I try to add an item to list

Prestashop - Add Image in product

How can I update product categories using prestashop web service?

Error when i try to opendir

An error when I add $state service to my references in angularjs module

why there is an error when I add backendless service for android in manifest?

I have a <div> element which contains an image and <figcaption>. When I try to add the padding to the <figcaption> it does not work

Why do I see `503 Backend Error` when I try to get a Cloud Storage service account?

why my app crash when i try to post some data into web service?

I get Metadata.framework error when I try to import an image

Using React Native, I get an error when I try to use a background image

I get an error when I try to change my upload image function name Django

Why am I getting this error when I try to type Text() or Image() in Button(action: {})?

ANTLR turns useful error messages into "no viable alternative" when I try to add custom error messages

Bad Argument error as I try to add noise to an image with Keras preprocess function

Why I have this error message when I try to add a new constructor to a class that extend another class?

Why I obtain this error when I try to add the Container object to the main JFrame object using Swing?