little-english Posted December 9, 2014 Share Posted December 9, 2014 Bonjour, Je sais qu'il existe déjà plusieurs topic à ce sujet, mais je n'arrive toujours pas résoudre mon soucis. Voici mon code : $image_path = $_SERVER["DOCUMENT_ROOT"].'/img/produit/123.jpg'; // $n = file_exists($image_path); retourne true $url = 'http://monurl/api/images/products/2'; $data = array('image' => '@'.$image_path); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_USERPWD, PS_WS_AUTH_KEY.':'); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); // retourne une erreur 500 $result = curl_exec($ch); curl_close($ch); Lorsque je regarde dans : http://monurl/api/images/ j'ai ceci : <products xlink:href="http://monurl/api/images/products" get="true" put="false" post="false" delete="false" head="true" upload_allowed_mimetypes="image/gif, image/jpg, image/jpeg, image/pjpeg, image/png, image/x-png"/> Alors que dans la configuration de mon webservice j'ai mis coché la case "POST" pour les images. Je ne sais pas si c'est lié. Je ne comprend pas trop mon erreur, car j'ai mis ( en attendant) les droits à 777 pour le dossier 'img' et à ses sous dossiers Cordialement, Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now