0
I created a simple file:
File file = new File("text.txt");
But I would like to convert this to a Multipartfile, which would be the best way?
I have tried the code below without success:
FileInputStream input = new FileInputStream(file);
MultipartFile multipartFile = new MockMultipartFile("file", file.getName(), "text/plain", IOUtils.toByteArray(input));
Thank you.
I think that that can help you
– renanvm
A primeira resposta já era o que eu tinha tentado, a segunda não funcionou também, apresentando o erro: (org.apache.commons.fileupload.FileItem) in CommonsMultipartFile cannot be applied to (org.apache.tomcat.util.http.fileupload.disk.DiskFileItem)
– Sabrina