在Django Restframework中发布图像以及flutter的文字

发布于 2025-01-20 06:40:08 字数 283 浏览 2 评论 0原文

我正在创建B2B电子商务移动应用程序。我将Flutter用作前端,Django作为后端。当我将邮政请求发送给Django服务器时,我被卡住了。情况是我有两种类型的用户。他们是卖方和买家。卖方必须在应用程序中发布产品。产品的模型字段是标题,描述,价格和图像。我在Django Rest框架中创建了Post方法,并且在检查Postman时起作用。但是我很难通过颤抖发送图像。我使用图像选择器来获取图像。我搜索了很多东西,但无法弄清楚该怎么办。我发现文章和视频一次仅发布图像,但我想与其他文本字段一起发送图像。我该怎么办?

帮助我找到解决方案。

I am creating a b2b e-commerce mobile application. I am using flutter as frontend and django for backend. I am stuck while sending a post request to django server with flutter. The case is I have two types of user. They are seller and buyer. The seller has to post product in the app. Model field for product are title, description, price and image. I created post method in django rest framework and it worked while checking through postman. But I am having hard time sending image through flutter. I used image picker to get the image. I searched for many things but could not figure out what to do. I found articles and videos posting only image at a time but i want to send image along with other text field. How can i do so??

Help me find a solution.

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

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

发布评论

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

评论(1

输什么也不输骨气 2025-01-27 06:40:08

最好将所选映像与Multipart和单独的API上传,但是如果您希望使用其他信息发送映像,则必须先降低图像质量,直到请求时间减少(请勿接收超时API),并且也使用基本64。

搜索更多信息的关键词,用base64上传图像

It is better that you upload your selected image with multipart and separate api, but if you want send image with other info , you must, first decrease quality of image until request time was decreased(don't receive timeout api), and also use base64 for this.

Key word for searching for more info, upload image with base64

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