DIRSIS Posted April 18, 2020 Share Posted April 18, 2020 Hola a todos ,no logro subir imagenes que estoy haciendo mal? $url="http://sd-1733945-h00003.ferozo.net/api/images/products/446"; $key="mikey"; //LA FOTO ESTA EN EL MISMO DIRECTORIO DONDE CORRO LA RUTINA $imagePath = 'logo.jpg'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); //curl_setopt($ch, CURLOPT_PUT, true); curl_setopt($ch, CURLOPT_USERPWD, $key.':'); curl_setopt($ch, CURLOPT_POSTFIELDS, array('image' => new CurlFile($imagePath))); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: image/jpg')); $result = curl_exec($ch); curl_close($ch); 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