I am uploading the mp3 file in my application, I have finished uploading the file and it works fine. I want to validate the file in server side, checking if the uploaded file is in a correct format(.mp3) or not. Client side validation works fine but I want to check it in server side as well, because there are changes to the upload the file by simply changing the extension.
I am using java servlet for uploading and I am having preprocessor to do validation before uploading.
Anyone help me,
Thanks in advance.
Apart from the extension, you can dive into the MP3 specification, read the file and verify if it conforms to the definition.
Probably you can use some Java library that already interprets the spec, like this one
But, unless you really need to, I think the extension checking is sufficient.