javascript - Get all images from local folder -


i need way images local folder presentation run locally. there no attempt server take images local folder since not possible/the case.

i need use .js since can't use .php (which easier) since runs on local pc.

say need take images learn/

i have tried various solutions can found here, here , here none worked.

i think best option use new file api in javascript. has lot of functions read files file system.

<input type="file" id="fileinput" multiple /> <script type="text/javascript">   function readmultiplefiles(evt) {     //retrieve files filelist object     var files = evt.target.files;       if (files) {         (var i=0, f; f=files[i]; i++) {               var r = new filereader();             r.onload = (function(f) {                 return function(e) {                     var contents = e.target.result;                     alert( "got file.n"                            +"name: " + f.name + "n"                           +"type: " + f.type + "n"                           +"size: " + f.size + " bytesn"                           + "starts with: " + contents.substr(1, contents.indexof("n"))                     );                  };             })(f);              r.readastext(f);         }        } else {           alert("failed load files");      }   }    document.getelementbyid('fileinput').addeventlistener('change', readmultiplefiles, false); </script> 

(code here)

you can find explanation , helpful code here.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -