Questions tagged [multipartfile]

127 questions
6
votes
1 answer

How to convert any image to JPG?

I am receiving a MultipartFile Spring object from rest controller. I am trying to convert any inage file to JPG image but I just need the byte array to save it on mongoDb I found this code to do that public boolean convertImageToJPG(InputStream…
TuGordoBello
  • 4,350
  • 9
  • 52
  • 78
4
votes
2 answers

In Swagger Code gen, how do i specify required fields when creating a multipart file upload request?

I'm using Java 11 and want to create an OpenAPI 3 request to upload multipart form data (a file and some other fields). I have this in my openApi yml file ... /myobjects/: post: tags: - my-objects summary: Adding…
Dave
  • 15,639
  • 133
  • 442
  • 830
4
votes
1 answer

Spring MVC POST request with dto that contains multipart files and other dtos

I have a DTO that contains other DTOs and a list of multipart files. I am trying to process that DTO but I can't seem to be able to read the requst. class TeacherDTO { private SpecializationDto specializationDto; private List
2dor
  • 851
  • 3
  • 15
  • 35
4
votes
1 answer

Can Spring Boot set the name of a file being downloaded from a controller endpoint?

Java 11 and Spring Boot 2.5.x here. I understand that I can set up a controller to return the contents of a file like so: @GetMapping( value = "/get-image-with-media-type", produces = MediaType.IMAGE_JPEG_VALUE ) public @ResponseBody byte[]…
hotmeatballsoup
  • 385
  • 6
  • 58
  • 136
4
votes
1 answer

Spring Boot pass/upload file from one api to another via WebClient

I have two Spring Boot Apis where I am first sending the multipart file from postman to one spring boot application and from there to the second spring boot application like so Postman (file) -> API 1 -> API2 When the file is uploaded from postman…
3
votes
2 answers

Why SpringDoc OpenAPI doesn't understand MultipartFile payload?

I'm working on a Spring boot application which has a controller to help upload Multipart files: @PostMapping("/files") public ResponseEntity uploadFiles( @RequestParam("file") MultipartFile[] file, String comment) throws…
sanjeev
  • 458
  • 1
  • 6
  • 15
3
votes
1 answer

My multipartfile disappears between my front and my back

I have a Java 11 application using spring boot. I have this request in my request controller : @RestController public class ImportController { private static final Logger LOGGER = LoggerFactory.getLogger(ImportController.class); …
Remi Colas
  • 41
  • 4
2
votes
2 answers

In SpringBoot, how do I create a custom validator for a MultipartFile parameter?

I'm using Spring Boot 2.4. I have the following controller with a method that accepts a MultipartFile object. @RestController public class MyController extends AbstractController ... @Override public ResponseEntity add( …
Dave
  • 15,639
  • 133
  • 442
  • 830
2
votes
0 answers

Couldn't upload image to server in Flutter Web

I've created a flutter application for android and web. In Flutter web, I tried to upload image to server just like it works with firebase. But it is not working somehow. I've seen some solutions for this task. But I wonder, what is actually wrong…
2
votes
1 answer

How to send multiple files from Angular as FormData to Spring Boot as MultipartFile[]?

My code below is for a single file upload, but I am trying to send multiple files from Angular to Spring Boot all at once. Sending multiple formdata to an ArrayList in Spring Boot results in null, and I can't @RequestParam a single formdata in…
2
votes
1 answer

Auto clean up tomcat cache - Multipart file temp uploads

I have Spring boot application that will allow user to upload multipart files and I will process those files. I have read in official documentation for multipart files. The uploaded multipart file contents are either stored in memory or temporarily…
2
votes
1 answer

MultipartException and IOFileUploadException when requests receives MultipartFile

I'm developing a spring API and I have an endpoint that receives a MultipartFile as parameter but in the production environment I'm receiving the following error in some cases: org.springframework.web.util.NestedServletException: Request processing…
João Durante
  • 273
  • 5
  • 14
2
votes
0 answers

Record real time Audio from browser and stream to Amazon S3 for storage

I want to record audio from my browser and live stream it for storage in Amazon S3. I cannot wait till the recording is finished as client can close the browser, so I would like to store what has been spoken (or nearest 5-10 second). The issue is…
2
votes
2 answers

Flutter - How to send multiple images in formdata

I want to upload multiple images in flutter using dio and formData. What I did is I created a for loop for storing MultipartFile in an array and then I passed the array to the data of "img[]". However, I cannot upload the image if I passed the array…
nit21
  • 125
  • 1
  • 4
  • 13
2
votes
1 answer

How do I display an image in a Flutter Web using Image.memory when I only have a Stream>? data-type?

Overview: I am using the file-picker library to allow the user to select one or multiple files from their device. The selected files will have the ability to be previewed before the selected files will be sent for storage using…
1
2 3
8 9