How can I check the file type (original type) with JQuery? I mean even if I change the file format manually from .pdf to .jpg, I should get .pdf because this file is PDF document not picture. I am using the following code for checking file type :
var fileExtension = ['jpeg', 'jpg', 'png'];
if ($.inArray(file_input.val().split('.').pop().toLowerCase(), fileExtension) == -1) {
alert("Wrong format!");
}
else {
alert("Correct format!");
}