0

I did coding for file upload in asp.net and validating a file extension (only png)

If user renames the file (before upload) from other to png (like pdf to png) then that file will valid as png because I just validate extension.

Is there any 3rd party API or service to validate file extension with valid content?

Thanks in advance

  • Also "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow". Direct quote from the [on topic](https://stackoverflow.com/help/on-topic) help page – MindSwipe Mar 27 '19 at 08:23
  • Another approach is not to validate image, but rather expect what it can be not an image when using uploaded file (to display image somewhere?). `try/catch` would do. – Sinatr Mar 27 '19 at 08:29

1 Answers1

0

You can try "File Signatures" https://en.wikipedia.org/wiki/List_of_file_signatures

MartinM43
  • 101
  • 1
  • 1
  • 8