title: How to get the real extension type of Multipart file
body: <p>I have  checked answer here, but here first they are saving it to some place and then reading it's stream and trying to check Mime type of that file</p>
  
  <p><a href="https://stackoverflow.com/questions/2091014/get-real-file-extension-java-code">Get real file extension -Java code</a></p>
  
  <p>But I want to know the file type before even saving it to the hard disk or at some place.</p>
  
  <p>I know I can do it in these 2 more ways </p>
  
  <pre><code>File savedFile = new File(fileHandler.createTodayFolder(fileLocation) + "/" + name);
              Path path = Paths.get(file.get);
              Tika tika = new Tika();
              String checkType = tika.detect(path.toFile()); 
  </code></pre>
  
  <p>and </p>
  
  <pre><code>          Path path = Paths.get(savedFile.getPath());
            Files.probeContentType(path)
  </code></pre>
  
  <p>But in these both cases they are using somefile which is already at some location in hard disk. 
  I want code something like this </p>
  
  <pre><code>  public @ResponseBody ResponseEntity&lt;?&gt; importResume(@RequestParam(value = "name", required = false) String name,
          @RequestParam("file") MultipartFile file) {
  
       if (file!=DESIRED_TYPE)
       {
         return Exception;
       }
  }
  </code></pre>
  
  <p>Is there any way of doing this ???</p>