Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload data from stdin as a file with a specific name via cURL

I'm using curl -F file=@- http://etc/upload to upload some data I'm piping into cURL, and that's working fine, but I'd like to be able to specify the file name that's reported to the server.

Is that possible? How?

like image 263
Gui Prá Avatar asked Oct 15 '15 21:10

Gui Prá


1 Answers

For protocols other than HTTP, and to use PUT for HTTP rather than form submission, use -T - with filename in URL:

echo bla-bla-bla | curl -T - ftp://user:[email protected]/foo.txt
like image 100
ivan_pozdeev Avatar answered Oct 10 '22 22:10

ivan_pozdeev