【问题标题】:How to send a file in a url via curl?如何通过 curl 在 url 中发送文件?
【发布时间】:2021-12-24 20:08:53
【问题描述】:

我在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 上进行测试。

【问题讨论】:

    标签: http curl https http-headers ipfs


    【解决方案1】:

    根据 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-03
      • 1970-01-01
      • 2022-11-29
      相关资源
      最近更新 更多