Skip to main content

Home/ Web 2.0 Tools/ Contents contributed and discussions participated by Shady Samir

Contents contributed and discussions participated by Shady Samir

Shady Samir

HTML5Rocks - Reading local files in JavaScript - 8 views

  • <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>', f.name, '</strong> (', f.type || 'n/a', ') - ',                  f.size, ' bytes</li>');    }    document.getElementById('list').innerHTML = '<ul>' + output.join('') + '</ul>';  }  document.getElementById('files').addEventListener('change', handleFileSelect, false);</script>
1 - 2 of 2
Showing 20 items per page