How might i take the output from a pipe and use curl to post that as a file?
E.g. the following workds
curl -F 'file=@data/test.csv' -F 'filename=test.csv' https://mydomain@apikey=secret
I'd like to get the file contents from a pipe instead but I can't quite figure out how to specify it as a file input. My first guess is -F 'file=@-' but that's not quite right.
cat data/test.csv | curl -F 'file=@-' -F 'filename=test.csv' https://mydomain@apikey=secret
(Here cat is just a substitute for a more complex sequence of events that would get the data)
Update The following works:
cat test/data/test.csv | curl -XPOST -H 'Content-Type:multipart/form-data' --form 'file=@-;filename=test.csv' $url
req.filedidn't exist (Node/Express). Hacking further adding the arguments-XPOST -H 'Content-Type:multipart/form-data'seemed to attach the data as the server expected--trace-ascii -you'll see that curl already use that Content-Type by default (and-XPOSTdoesn't help either). It was rather your fixed -F option that did the trick.