Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

curl upload file -T

I get the error curl: Can't open '[email protected]'! when trying to run code:

curl -v -XPOST -k -H "Accept: application/json" -T "[email protected]"  https://192.168.1.102/

any suggestion on how to pass the text file's name properly?

like image 794
Nicky Mirfallah Avatar asked Mar 06 '26 02:03

Nicky Mirfallah


1 Answers

-T is for PUT and wants a file name only:

curl -T 1.txt https://192.168.1.102/

You seem to want to POST a file? If you want it sent "plainly", you probably want:

curl -H "Accept: application/json" --data-binary @1.txt https://192.168.1.102/

If you want to instead send the file as a multipart formpost, you might do it similar to:

curl -F [email protected] https://192.168.1.102/
like image 197
Daniel Stenberg Avatar answered Mar 08 '26 03:03

Daniel Stenberg