Jump to content

WebSErvice. Actualizar imagen WebService


Lunik77

Recommended Posts

570

Hola :

 

Queria realizar la actualizacion de una imagen a traves de WebService, en mi caso desde Delphi.

Como no encuentro nada al respecto queria partir de algun ejemplo realizado en php para luego (al conseguirlo) intentarlo en Delphi.

 

He probado el siguiente codigo... pero no doy conseguido que funcione.

 

<?php
  $url = 'http://127.0.0.1/prestashop/api/images/products/1/24';
  $imagePath = 'c:\\imagen.jpg';
  $key = 'el key correspondiente';

  $ch = curl_init();

  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_PUT, true);
  curl_setopt($ch, CURLOPT_USERPWD, $key.':');
  curl_setopt($ch, CURLOPT_POSTFIELDS, array('image' =>  new CurlFile($imagePath)));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: image/jpg'));
  echo $result = curl_exec($ch);
  curl_close($ch);
?>

 

El error que me da es :

 

<![CDATA[Please set an "image" parameter with image data for value]]></message>

 

Alguna idea?

 

Un saludo y gracias

Lunik

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