In a web project, users upload their files, but when I receive them on the server, they are being stored as .tmp files rather than their original file extension (this is my
This answer suggests using:
InputStream is = new BufferedInputStream(new FileInputStream(file)); mimeType = URLConnection.guessContentTypeFromStream(is); //...close stream