http - 如何通过 curl 在 url 中发送文件?
问题描述
我在https://i.postimg.cc/GpDskmSG/sdssds.png之类的 URL 中有一个图像,我想将其发送到 nft.storage 中。我可以直接将其作为 URL 而不是路径中的文件发送吗?我尝试了以下方法,但它只存储图像 URL。
curl -H "Authorization: Bearer eyJhbGciOiJIwetertyrtyUzI1NiIsInR5cCI6Ikp" -H "Content-Type: image/png" --data "https://i.postimg.cc/GpDskmSG/sdssds.png" --url "https://api.nft.storage/upload"
P/S:我正在测试 windows curl。
解决方案
根据 API 文档 ( https://nft.storage/api-docs/ ),它将接受这种类型的 POST 的 multipart/form-data。
您可以尝试使用 -F/--form 代替,curl 手册页 ( https://linux.die.net/man/1/curl ) 上有一个很好的示例:
curl -F "web=@index.html;type=text/html" url.com
推荐阅读
- javascript - 了解箭头功能 - 为什么这不起作用而这起作用?
- javascript - 如何使用对象数组设置背景图像?
- vb.net - 使用VB.Net计算excel中的工作表数量
- docker - VSCode 远程容器连接错误 ECONNREFUSED 127.0.0.1:8888
- python-2.7 - Python 2.7 和 Spyder 3.0
- sdk - 使用 SAP 云 SDK 运行本地应用程序时缺少 VCAP_SERVICES
- python - Process 使用 Simpy 在 Python 中生成一个 Process
- assembly - 如何解决堆栈安全问题组装
- sql - 如何解析多种geojson特征类型并写入SQL Geography列
- c - 如何使用STM32和3个蓝牙模块连接?