Upload File in HTTP POST

149 views
Skip to first unread message

David Iffland

unread,
May 21, 2021, 9:48:01 PM5/21/21
to Automate
I can't seem to figure out how to upload a file using the HTTP block. I tried skipping over to curl, but I have a different problem with single and double quotes. Here's what my CURL command is

curl --location --request POST 'https://location
--header 'Authorization: Bearer mytoken' --form 'csvData=@"/home/user/volume2/scratch/datafile.csv"'

Works as expected on ubuntu, but can't figure out how to put that in the shell curl block. I'd rather do the HTTP block if I can figure out how to post a file. 

Any ideas?

Henrik "The Developer" Lindqvist

unread,
May 22, 2021, 11:46:28 AM5/22/21
to Automate
You need to create the whole multipart form body, try...
  • Request URL: https://location/
  • Request method: POST
  • Request content type= "multipart/form-data;boundary=BoUnDaRy"
  • Request content body= [ "--BoUnDaRy\r\nContent-Disposition:form-data;name=\"csvData\";filename=\"datafile.csv\"\r\n\r\n", "\r\n--BoUnDaRy--\r\n" ]
  • Request content path: /home/user/volume2/scratch/datafile.csv
  • Request headers= { "Authorization": "Bearer mytoken" }
Reply all
Reply to author
Forward
0 new messages