-
Notifications
You must be signed in to change notification settings - Fork 502
Description
It's impossible to post files by http using cURL via the Request API.
If you look at the code in the setup_handle method in Requests_Transport_cURL class found in the /Requests/Transport/cURL.php file, you'll see that the POST data is always converted to a string using the PHP http_build_query function. However, according to the PHP manual, the value passed to CURLOPT_POSTFIELDS must be an array if files are passed to this option.
A possible fix could be to simply add the post value to the CURLOPT_POSTFIELDS option as an array if the Content-Type header has been given as multipart/form-data. It would be converted to a query string otherwise. According to the PHP manual, the multipart/form-data Content-Type header will be set if the post value is an array.