Jump to content

Image Update WebService API Fail Php Bug on PUT Method and $_FILES


Recommended Posts

Hi:

 

Does Image Update Method from API WebService works ?

 

I'll try all instructions details, but I check that PHP has a BUG with PUT method, when receive files in multipart, it doesn't load the $_FILES array, so it's imposible to use both PUT HTTP Method and $_FILES loaded in multipart request.

 

https://bugs.php.net/bug.php?id=55815

 

http://forge.prestashop.com/browse/PSCFV-7498

 

 

So this part in Manual it's wrong:

http://doc.prestashop.com/display/PS15/Chapter+9+-+Image+management

 

Actually you can't update images in prestashop, because of a PHP BUG

Link to comment
Share on other sites

  • 1 month later...

Hello

 

i can confirm is not possible updating images through curl put method...

 

curl_setopt($ch, CURLOPT_PUT, true); does not upload anything...

$data_img= array('image'=>"@".$image_path.";type=image/jpeg");
        $ch = curl_init();
        curl_setopt($ch,CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_URL, $url);        
        if($resources->id_default_image > 0){
            curl_setopt($ch, CURLOPT_PUT, true);// Un-commet to edit an image
            $msg = "Immagine aggiornata";
        }
        else{           
            $msg = "Immagine inserita";
        }
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_HTTPAUTH, 'CURLAUTH_BASIC');
        curl_setopt($ch, CURLOPT_USERPWD, PS_WS_AUTH_KEY);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_img);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        if(curl_exec($ch) === false)
        { $return .= "Errore upload img ".curl_error($ch); }
        else
        { $return .= $msg; 
                
        }
        curl_close($ch);

hope it will be solved soon

Link to comment
Share on other sites

×
×
  • Create New...