【问题标题】:Angular / SpringBoot how to send an image file as Request Body?Angular / SpringBoot如何将图像文件作为请求正文发送?
【发布时间】:2020-02-16 14:27:31
【问题描述】:

我看到的所有教程都倾向于将图像视为独立模型并使用 FormData 发送它,我想要的是将图像文件作为对象的属性包含在名为 Course 的对象中,

这样做的过程是什么,如果它是模型的属性,我应该以什么方式在后端接收我的图像

【问题讨论】:

    标签: angular spring-boot http


    【解决方案1】:

    您可以通过使用@Multipart 注释并将图像获取为MultiPartBody.part 来使用它。您可以查看以下链接以获取更详细的说明。 How to Upload Image file in Retrofit 2

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-18
      • 2018-01-03
      • 1970-01-01
      • 2021-07-07
      • 1970-01-01
      • 2019-03-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多