In brief
The name ending in .pdf does not prove the file format.
Useful to know
endsWith() checks the end of a string. For example, "report.pdf".endsWith(".pdf") returns true. The check differs uppercase and lowercase : ".PDF" is another sequence . [1]
This is convenient for visually grouping names, but does not authenticate the contents of an uploaded file. A file with random bytes can also be called report.pdf. When uploading, the application must check the actual allowable types and limitations of the server. Do not mix the convenient presentation of the name with proof that the document can be safely processed.
Sources
For further detail and to check the information: