javi.villa Posted October 3, 2014 Share Posted October 3, 2014 Hi all, Im trying to upload image to a existing category using curl, i CAN update an image but i CANT add a new image: My code: (category 50 exists) $ch = curl_init(); $cfile = curl_file_create($urlImage,'image/jpeg','image'); $data = array('image' => $cfile); $url = "http://localhost:8888/presta16/prestashop/api/images/categories/50" curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_USERPWD, $apiKey.':'); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch,CURLOPT_HEADER, true); curl_setopt($ch,CURLINFO_HEADER_OUT, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); It returns a 400 error. PS version: 1.6 Thanks all Link to comment Share on other sites More sharing options...
Recommended Posts