Nicky Mirfallah
Nicky Mirfallah

Reputation: 1054

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?

Upvotes: 3

Views: 5501

Answers (1)

Daniel Stenberg
Daniel Stenberg

Reputation: 58004

-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/

Upvotes: 3

Related Questions