Created
May 12, 2016 14:27
-
-
Save washingtonsoares/caee039febada797413a54181084b74d to your computer and use it in GitHub Desktop.
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
<input type="file" id="files" name="files[]" multiple /> | |
<output id="list"></output> | |
<script> | |
function handleFileSelect(evt) { | |
var files = evt.target.files; // FileList object | |
// files is a FileList of File objects. List some properties. | |
var output = []; | |
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('list').innerHTML = '<ul>' + output.join('') + '</ul>'; | |
} | |
document.getElementById('files').addEventListener('change', handleFileSelect, false); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment