ProgerXP / FileDrop

Self-contained cross-browser pure JavaScript class for Drag & Drop and AJAX (multi) file upload.
filedropjs.org
The Unlicense
264 stars 61 forks source link

MIME type before upload? #79

Closed moscorp closed 3 years ago

moscorp commented 3 years ago

how to restrict MIME type before upload?!

ProgerXP commented 3 years ago

See examples in filedropjs.org. MIME type is accessible via File.type. Or, on the server-side, use PHP's $_FILES['upload']['type'] or mime_content_type().

However, MIME checks are generally unreliable both client- and server-side. It's better to check file's actual contents using Fileinfo (PHP), gd, etc..