Jump to content

Unable to save images via Web Service


Recommended Posts

Hello,

I´m trying to add a manufacturer image via WS but I receive this error:

 

<?xml version="1.0" encoding="UTF-8"?>

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">

<errors>

<error>

<code><![CDATA[66]]></code>

<message><![CDATA[unable to save this image]]></message>

</error>

</errors>

</prestashop>

 

I think that the image permissions is related with the problem:

 

<manufacturers xlink:href="http://localhost/myweb/api/images/manufacturers" get="true" put="false" post="false" delete="false" head="true" upload_allowed_mimetypes="image/gif, image/jpg, image/jpeg, image/pjpeg, image/png, image/x-png"/>

 

I am using a .NET program with PrestaSharp to update the manufacturers. You can find the source code from GitHub:

https://github.com/E...von/PrestaSharp

 

You can see the settings of my web service in the attached file.

 

Thanks in advance.

post-627430-0-11945100-1376581460_thumb.png

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...
  • 1 year later...
  • 3 years later...

Bonjour, 

je travaille sur php et j'ai ce meme probleme d'insertion d'image pour un produit 

pourriez vous m'aider la dessus svp 

 function addImage($idProduct)
        {

            $key = 'UVJJQ3HT8RHUPGDKE4LNZ21K973PAA84';
            $url = "http://myshop/api/images/products/".$idProduct."/";
            $image_path = 'file:///C:/wamp/www/api/image.jpg';

            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_HTTPHEADER,array('Content-Type: image/jpeg'));
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_USERPWD, $key);
            curl_setopt($ch, CURLOPT_POSTFIELDS,  array('name' => 'Foo', 'file' => $image_path));
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $result = curl_exec($ch);
            var_dump($result);
            curl_close($ch);
            print_r($result);
            echo '<h2>Image Added</h2>'; 

        }

merci d'avance pour vos réponses :)  

Link to comment
Share on other sites

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...