title: How do I get the File name in Apache Tika
body: <p>How do I determine the name of a document in Tika Example: <em>person.pdf</em> ?</p>
  <p>Mimetype I get as <em>application/pdf</em> but I have the problem that customers sometimes upload documents that are allowed for example: <em>image.png</em> but they are rewritten to <em>image.pfd</em> and the document is then broken.</p>
  <p>I want to check once the allowed mimetype with:</p>
  <pre><code>Arrays.stream(mimetypes).anyMatch(metadata.get(&quot;Content-Type&quot;)::equals)
  </code></pre>
  <p>and the document name with my document mimetype.
  The end after the dot or slash like:</p>
  <blockquote>
  <p>Mimetype: image/<strong>png</strong> and Document name: image.<strong>pdf</strong></p>
  </blockquote>
  <p>In this case the user uploaded a PNG but before that he rewritten the .png to .pdf (document should be broken) and I don't know how to check or get that information.</p>