Can any one tell me what is a the best way to convert a multipart file (org.springframework.web.multipart.MultipartFile) to File (java.io.File) ?
In my spring mvc w
You can also use the Apache Commons IO library and the FileUtils class. In case you are using maven you can load it using the above dependency.
commons-io
commons-io
2.4
The source for the MultipartFile save to disk.
File file = new File(directory, filename);
// Create the file using the touch method of the FileUtils class.
// FileUtils.touch(file);
// Write bytes from the multipart file to disk.
FileUtils.writeByteArrayToFile(file, multipartFile.getBytes());