How Can I Read A Local File When The User Presses A Button Using The Html5 File Api ?
I'm trying to use jQuery and the HTML5 File API to get data from a local file. I want to read the file and get text from it, but only when the user presses a button, not when the i
Solution 1:
The files
array is a property of a <input type=file>
DOMElement. I don't know how to access it with jQuery, but you can always get the backing DOMElement from a jQuery element using .get(0)
, so you can access your files here:
var files = $('#file').get(0).files;
Or with plain javascript:
var files = document.getElementById('file').files;
Post a Comment for "How Can I Read A Local File When The User Presses A Button Using The Html5 File Api ?"