curlconverter / curlconverter

Transpile curl commands into Python, JavaScript and 27 other languages
https://curlconverter.com
MIT License
7.17k stars 867 forks source link

CURLFile is not correct ! #593

Closed typeoo closed 6 months ago

typeoo commented 7 months ago

curl_setopt($ch, CURLOPT_POSTFIELDS, [ 'file' => new CURLFile('test.mp3;type=audio/mpeg'), ]);

it should be like:

curl_setopt($ch, CURLOPT_POSTFIELDS, [ 'file' => new CURLFile('/var/www/html/voice/test.mp3',"audio/mpeg","test") ]);

verhovsky commented 7 months ago

curl commands to test:

curl -F 'file=@test.mp3;type=audio/mpeg' localhost:8888
curl -F 'file=@test.mp3;type=audio/mpeg;filename=test' localhost:8888
curl -F 'file=sometext;type=text/plain;filename=test' localhost:8888

This requires implementing #217 first