1

enter image description here

I need to upload a file with spring boot, actually this file it's included in a dto which itself included into another one. When I try to test into swagger I don't have a bar to upload the file, it's look like I had to write the file path instead of uploading it. I have the warrantyRequestNormalCreationDto which had a list of WarrantyRequestNormalPartsCreationDto which each item have a MultiparFile when I try to save it either I don't have a bar to select the files for each item (photo).

public class WarrantyRequestNormalCreationDto extends WarrantyRequestNormalDetailsDto {
  private String reparationPictureFileName;
  @EqualsAndHashCode.Exclude
  private MultipartFile reparationPictureFile;
  private String workOrderFileName;
  @EqualsAndHashCode.Exclude
  private MultipartFile workOrderFile;
  private List<@Valid WarrantyRequestNormalPartsCreationDto> warrantyRequestNormalParts;
}
public class WarrantyRequestNormalPartsCreationDto implements Serializable {

  private Integer id;
  @NotBlank
  private String constructorSerialNumber;
  @NotNull
  @DateTimeFormat(pattern = "yyyy-MM-dd")
  private LocalDate manufactureDate;
  private float failureQuantity;
  @NotNull
  private FailureCodeEnum failureCode;
  @NotBlank
  private String ArticleCode;
  @NotBlank
  private String numberplateFileName;
  @EqualsAndHashCode.Exclude
  private MultipartFile numberplateFile;
  private Integer warrantyRequestNumber;

}
thanks a lot !

a way to have a bar to uplaod the file.

Eya Cherni
  • 11
  • 2
  • could you share any code to describe your problem more detail? – kerbermeister Mar 07 '23 at 20:35
  • Please provide enough code so others can better understand or reproduce the problem. – Community Mar 08 '23 at 15:15
  • In fact, I have a Dto which contains another dtos and each one of these dtos have multipart file. Usually in swagger if I have a dto with multipart file I have a bar to upload the file. But with included dtos it's look like entering a string into each file. – Eya Cherni Mar 09 '23 at 09:34
  • it's the same problem as here https://stackoverflow.com/questions/52622944/how-to-handle-request-with-json-and-multipart-file-in-spring-boot – Eya Cherni Apr 02 '23 at 20:12

0 Answers0