I have to find the original content type(MIME Type) of a file at the time of Uploading.

I want to allow only PDF files, But if i am renaming an .exe fiel to .pdf flie, its type is showing pdf. 

I want to restrict these kind of files.

**I am using the following code:**

```
if (!fileMultipart.getContentType().equalsIgnoreCase("application/pdf")) {
        msg = "Only pdf files are allowed.";
        System.out.println("Only pdf files are allowed.");
    }

```

Also some online tools are available to find the original content type. I tried using <http://www.checkfiletype.com/> and it works.