File Upload Get MIME Type using JavaScript

<html>
<body>

    <input type="file" id="upload-files" multiple>
    <script>
    var control = document.getElementById("upload-files");
    control.addEventListener("change", function(event) {      
        var files = control.files;
        for (var i = 0; i < files.length; i++) {
            console.log("Filename: " + files[i].name);
            console.log("Type: " + files[i].type);
            console.log("Size: " + files[i].size + " bytes");
        }
    }, false);
    </script>

</body>
</html>
It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *