How to upload photo with php curl?

Viewed 47

I want upload photo with php curl. This my code but not work.

$uploadRequest = array(
            'name' => 'profile_pic',
            'filename' => 'profilepic.jpg',
            'form-data' => base64_encode(file_get_contents("http://res.cloudinary.com/brk/image/upload/kadin/168.jpg"))
        );

I use this array in curl;

..
CURLOPT_POSTFIELDS => $uploadRequest,
..

This is XHR headers info when i upload photo as manuel:

Content-Disposition: form-data; name="profile_pic"; filename="profilepic.jpg"
Content-Type: image/jpeg

Where am I doing wrong?

0 Answers
Related