尝试添加图像web服务prestashop时出错


Error when I try to add an image web service prestashop

我试图使用web服务将图像添加到产品中,但每次尝试都会出错。在我搜索过的几乎所有页面中,这是他们给我的代码:

    $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>";

但它总是给我以下错误。

错误翻译:

192.168.1.124页不起作用。

192.168.1.124页面目前无法处理此请求。

任何帮助都将不胜感激。问候!

我解决了这个问题。我将文件命名为"Añadir Imagen",localhost似乎无法识别"ñ"字符。

希望它能帮助有同样问题的人。

问候!