我正在使用 curl -F file=@- http://etc/upload
上传一些数据,我正在通过管道传输到 cURL,这工作正常,但我希望能够指定报告给服务器的文件名。
这可能吗?怎么样?
最佳答案
从 curl 手册页:
-F/--form
...
You can [...] explicitly change the name field of an file upload part by setting filename=, like this:
curl -F "file=@localfile;filename=nameinpost"
所以这正是我想要的。例如:
$ echo funfunfun | curl -F file=@-;filename=fun.txt http://etc/upload
我发誓在问之前我已经阅读了几次手册页,但直到现在才找到那个特定的段落。
关于curl - 通过 cURL 从 stdin 上传数据作为具有特定名称的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33158990/