Created
August 16, 2012 15:41
-
-
Save jparbros/3371170 to your computer and use it in GitHub Desktop.
file_reader.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function handleFileSelect(evt) { | |
| var files = evt.target.files; // FileList object | |
| window.fileContent = evt.target.result; | |
| // files is a FileList of File objects. List some properties. | |
| var output = []; | |
| var contents = e.target.result; | |
| for (var i = 0, f; f = files[i]; i++) { | |
| output.push('<li><strong>', escape(f.name), '</strong> (', f.type || 'n/a', ') - ', | |
| f.size, ' bytes, last modified: ', | |
| f.lastModifiedDate.toLocaleDateString(), '</li>'); | |
| } | |
| document.getElementById('test').innerHTML = '<ul>' + output.join('') + '</ul>'; | |
| } | |
| document.getElementById('bulk_products_facets_csv').addEventListener('change', handleFileSelect, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment