0
prestashop dev's exampleを使用して製品イメージをアップロードしようとしています。ここでPrestashop 1.7 cURL経由で製品イメージをインポートしていません
は私のコードです:
$image_path = 'http://www.naminukas.lt/out/pictures/master/straipsniai/thumb/skalbimo_masinos_pelesis.jpg';
$url = 'http://46.101.240.63/api/images/products/198';
$key = 'myapicode';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
//curl_setopt($ch, CURLOPT_PUT, true); // Un-commet to edit an image
curl_setopt($ch, CURLOPT_USERPWD, $key.':');
curl_setopt($ch, CURLOPT_POSTFIELDS, array('image' => '@'.$image_path));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
それから私はhtmlコードをアップロードしようとしている、それはだ
<form enctype="multipart/form-data" method="POST" action="http://[email protected]/api/images/products/1">
<fieldset>
<legend>Add image for products No 1</legend>
<input type="file" name="image">
<input type="submit" value="Execute">
</fieldset>
</form>
を動作しますが、カールして、それはエラー66を取得していないし、ない、にできません。この画像をアップロードする。
ご意見はありますか?
P.S:PHP 7.0を使用しています。