When I try to set it, it forces the request method to be PUT.
Here is what I put in CURLOPT_POSTFIELDS:
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'fileUpload' => '@/home/apache/upload/dummy.sql'
));
Or should I ignore the CURLOPT_UPLOAD at all? It said prepare for file upload...
You can safely ignore it.
CURLOPT_POSTFIELDS
is just enough to upload a file. The curl library will recognize the file upload and set what's required internally itself.
The idea behind CURLOPT_UPLOAD
is to tell curl to use PUT
method, add some common file uploading headers for that such as Expect: 100-continue
header and use chunked encoding to upload a file of unknown size if you are using HTTP/1.1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With