strapi在收集类型中上传图像URL

发布于 2025-02-12 14:23:47 字数 75 浏览 0 评论 0原文

如何将图像URL上传到Strapi Collection类型,我想更新该字段 我尝试了各种上传方法,但没有得到任何结果,有人可以帮忙吗?

How can i upload image URL to Strapi collection types and I want to update the field
I have tried various methods to upload but didn't got the result can anyone help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心如荒岛 2025-02-19 14:23:47

在strapi上上传图像,首先您必须使用 /上传请求,然后将文件作为请求主体传递。
使用此API的响应作为图像的字段值。

假设,您的产品集合具有称为Image的属性,其数据类型是媒体。
要将图像存储到此属性中,
首先致电 /上传API并将请求主体作为“文件”传递:当您尝试将图像存储在产品中时,请使用此 /uploads api的映像bytes和响应。

在创建产品时,Inside Insim属性使用 /上传API响应。
你已经完成了。

In strapi to upload the image, first you have to use /uploads request and pass file in bytes as an request body.
Use the response of this API as an field value of image.

Suppose, you have products collection which has attribute called image and its datatype is media.
To store image into this attribute,
first call /uploads API and pass request body as "files":image-bytes and response from this /uploads API is used when you try to store image in product.

While creating the product, inside image attribute use /uploads API response.
And you are done.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文