json - 如何发布两个文件
问题描述
我正在尝试使用命令发布两个不同的文件
curl -vX POST http://localhost/api/postJSON -d @input.json -d @input2.json --header "Content-Type: application/json"
我知道有些不对劲。有人对此有任何想法吗?
解决方案
查阅 curl 手册页并确定-F
选项(https://curl.haxx.se/docs/manpage.html#-F)。
还有一个通过 curl 上传多个文件的示例,网址为https://medium.com/@petehouston/upload-files-with-curl-93064dcccc76#e822
$ curl -F 'fileX=@/path/to/fileX' -F 'fileY=@/path/to/fileY' ... http://localhost/api/postJSON upload
推荐阅读
- angular - 如何正确覆盖从使用可观察的服务继承的服务中的方法?
- python - Django 模型中的 Q() 和两个条件的问题
- python - 如何在 Python 中从 API json 响应中获取特定数据
- flutter - Flutter:如何在启动前确定图像的缓存大小?
- python-3.x - Allure 无法读取生成的 json 文件,并且附件未附加
- graph - 调用刷新时,MGT GET 组件使用加载模板重新呈现,但轮询不会发生这种情况
- matlab - MATLAB coder app 2011版和2021版如何打开(MATLAB online)?
- linux - 如何确保 ffmpeg 库使用/不使用 GPU
- python - while 循环没有根据条件集正确运行
- c++ - createdefaultsubobject 函数不适用于 UWidgetComponent[UE4.26.2]