Detect file mime type using magic numbers and JavaScript
The browser File API in the quite powerful, the requirement of modern website is not just text and images but also video, sound and other binary formats, this has led to an improved support for handling files directly in the browser.