I\'ve been setting up an import script for plain-text files in a web application.
My script is as follows:
function dataImport(files) {
confirm(\
The Content Type can be read with the following code:
// Note: File is a file object than can be read by the HTML5 FileReader API
var reader = new FileReader();
reader.onload = function(event) {
var dataURL = event.target.result;
var mimeType = dataURL.split(",")[0].split(":")[1].split(";")[0];
alert(mimeType);
};
reader.readAsDataURL(file);