javascript - How do I read from external files in JS Bin? -


i've been doing code year @ codecademy , wanted start practicing javascript myself, i've been having tough time figuring out basic issues.

for first project, want read in spreadsheet. can't figure out how access data original source online, thought save text file. question, then, how read that.

so looks can't read local files in javascript. (although apparently that's changing html5? don't have familiarity that.) have upload text file someplace? can upload files js bin? if not, have recommendations can upload text file? , either way, once do, what's code read it?

thanks in advance. sure question riddled misstatements , improprieties, i've spent significant amount of time on , can't find seems answer question. thought simple, "var inputfile = c:\file.txt" seems not case. totally lost. thanks!

you can't. file system , storages in javascript (or rather client) sandboxed.

that means can read written there in first place. has security.

you need drop (or select) local files browser , have mechanism there receive drop/selection , store file 1 of local storing mechanisms such indexeddb or file api (the latter supported in chrome). text files localstorage works fine too.

resources:
http://updates.html5rocks.com/2011/08/saving-generated-files-on-the-client-side
http://www.w3schools.com/html/html5_webstorage.asp

http://www.w3.org/tr/webstorage/
http://www.w3.org/tr/fileapi/
http://www.w3.org/tr/indexeddb/

the other option upload server , download there when need it.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -