uploadFile always creates files with application/octet-stream MIME type
Closed this issue · 0 comments
aliakseiz commented
In uploadFile method there is following code:
final File tempFile = File.createTempFile("mediauploadwpj", null); // it creates file with .tmp extension
tempFile.deleteOnExit();
Files.copy(media, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
final String mimeType = new MimetypesFileTypeMap().getContentType(tempFile); // always returns application/octet-stream type
File.createTempFile("mediauploadwpj", null)
Shouldn't it be replaced with something like this?
File.createTempFile("mediauploadwpj", mimeType)
or better replace
final String mimeType = new MimetypesFileTypeMap().getContentType(**tempFile**)
with
final String mimeType = new MimetypesFileTypeMap().getContentType(**fileName**)