Skip to content Skip to sidebar Skip to footer

Read The Contents Of A "file" Object?

So I have a 'File' object (retrieved by handling file drag and drop from desktop). I can send the files to the server with ajax, and then throw them back for javascript to handle t

Solution 1:

Using the links from Martin Mally (thanks a lot!), I came up with this:

var file = e.dataTransfer.files[0],
    read = new FileReader();

read.readAsBinaryString(file);

read.onloadend = function(){
    console.log(read.result);
}

Where read.result holds the contents of the file.


Solution 2:


Post a Comment for "Read The Contents Of A "file" Object?"