0

I need to upload a CSV file using CURL command. The API where I am posting this file only accepts file in UTF-8 encoding. Here is my CURL command:

curl \
  --request POST \
  --url "url" \
  --header "Content-Type: multipart/form-data" \
  --form "file=file.csv;type=text/csv;charset=utf-8"

But when I run above command it fails to upload the file. Can someone please help? Thanks.

reactdesign
  • 167
  • 1
  • 11
  • What’s the actual encoding of the file? If it’s not UTF-8, then you need to convert it to an actual UTF-8 file first. – deceze Apr 05 '23 at 16:07
  • I have checked the encoding it is in UTF-8. But still doesn't work – reactdesign Apr 06 '23 at 08:04
  • Then that’s because you’re not actually uploading a file. `--form "file=file.csv"` does not make curl read any file data. – deceze Apr 06 '23 at 08:06

0 Answers0