Subscribe Join 180,000+ subscribers and receive articles from our blog about software quality, testing, QA and security. Subscribe

File Upload using curl

Hello

i’d like to upload my test result text file using curl commnad.
so i copied curl commnad that can be seen chrome developer mode.

this is curl commnad which i copied
curl ‘URL’
-H ‘authority: SECRET’
-H ‘accept: application/json’
-H ‘cache-control: no-cache’
-H ‘x-requested-with: XMLHttpRequest’
-H ‘user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36’
-H ‘content-type: multipart/form-data; boundary=----WebKitFormBoundaryDKAUiCRRjLKNbi10’
-H ‘origin: SECRET’
-H ‘sec-fetch-site: same-origin’
-H ‘sec-fetch-mode: cors’
-H ‘sec-fetch-dest: empty’
-H ‘referer: SECRET’
-H ‘accept-language: ja,en-US;q=0.9,en;q=0.8’
-H ‘cookie: tr_session=5e2ddf33-5c0d-46e6-aaa0-1aa670e28854; tr_rememberme=91%3Adap7qYB0TWFvM4xLuuO1-G8aLov6lTQZOgd0akdqt; ’
–data-binary $’------WebKitFormBoundaryDKAUiCRRjLKNbi10\r\nContent-Disposition: form-data; name="_token"\r\n\r\nsMviQF3Ff5YbpDMyuMm8\r\n------WebKitFormBoundaryDKAUiCRRjLKNbi10\r\nContent-Disposition: form-data; name=“attachment”; filename=“test.txt”\r\nContent-Type: text/plain\r\n\r\n\r\n------WebKitFormBoundaryDKAUiCRRjLKNbi10–\r\n’
–compressed

The question what i want to know is how i can assign my local file to upload with this curl commnad. When i use above commnad just changing filename, then all uploaded file was 0 byte empty file.

Please I’d like to know how to upload test results with curl commnad
thx