0

I know in order to check corrupted files, we can read entire file too see if there's exception for corrupted files. However, that doesn't check for valid/invalid format, it will succeed even with a corrupted pdf. so corresponding to each format, we have to use standard library (i.e. pdf library) to read entire file which is kinda tedious. I am wondering if there is better solution Or are there any packages/Services that we can validate multiple types, so we don't need a separate api for each one.

Jin Lin
  • 293
  • 1
  • 6
  • 16
  • [This answer](http://stackoverflow.com/a/1915344/416300) suggests using [Java Mime Magic Library](http://sourceforge.net/projects/jmimemagic/) – summerbulb Jun 08 '15 at 18:56
  • @summerbulb this isn't only detect mimetype, but also detect corrupted files. – Jin Lin Jun 08 '15 at 19:14
  • The mimetype is determined using the file data and so will let you know if the _format_ is corrupted. Are you interested in validating the file's integrity or are you scared of malicious files? – summerbulb Jun 09 '15 at 05:45
  • @summerbulb I scared when I downloaded user's uploaded files on s3, I am unable to open it. so I want to not accept this kind of files. – Jin Lin Jun 09 '15 at 16:32

0 Answers0