Suppose users can upload files, I want to find the extension of the uploaded file. Even if the user has renamed the extension of the file, I want to find the real extension of that file by it's header or bytecode..etc.
Please help me with a solution.
Note: Not just the extension by substring() or getContentType() but the real file extension, say for example(in windows), its a .doc file and user renames it to .jpg and uploads it. Its possible in php, but I don't know how to do that in java! but it can be done. Thank you.