I’m working on a PHP web application which will accept Markdown files as a file input.
How should I make sure that Markdown and only Markdown files are being uploaded?
I think I should check more than the extension… maybe the mime type?
If so, what is that mime type?
extension and mime type are same.
check UTF-8, you can block any binary files (image files, etc)
if an user uploads a HTML or JavaScript file, it is not what you want, but it match the Markdown syntax. so PHP can’t identify it.