I have a file with extension xlsx, now if i change its extension to png, then is there any way to get the actual content type of that file i.e. xlsx. I have to determine it for some security reasons. have to restrict the files other than image files. But user can upload the files after renaming them as i am checking files by extensions. Please help.
I did this:----- final MimetypesFileTypeMap fileTypeMap = new MimetypesFileTypeMap();
System.out.println( fileTypeMap.getContentType("/home/ist-48/Downloads/report.png"));
actually report is a xlsx file.. but its returning:--- image/png