Answers for "Converting File to MultiPartFile with spring, This is another way of getting multipart file from File object MultipartFile multipartFile"

1

file to multipartfile in java

File file = new File("src/test/resources/input.txt");
FileInputStream input = new FileInputStream(file);
MultipartFile multipartFile = new MockMultipartFile("file",
            file.getName(), "text/plain", IOUtils.toByteArray(input));
Posted by: Guest on January-13-2021

Code answers related to "Converting File to MultiPartFile with spring, This is another way of getting multipart file from File object MultipartFile multipartFile"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language