简体   繁体   中英

Reading a local directory in javascript

Do you guys have an idea on how to read a local directory using javascript?

Like I need to output in a list the elements of a certain directory.

I saw something like using

window.requestFileSystem(window.TEMPORARY, 1024*1024, onInitFs, errorHandler); 

but in the onInitFs function this line gives out the fs.root is undefined error.

function onInitFs(fs) { var dirReader = fs.root.createReader();var entries = [];... }

Can you help me bout this? Thanks a lot.

By the way, the page will be running on IE8.

AFAIK, requestFileSystem is only supported by Chrome with webkitRequestFileSystem version. Other browsers don't support it.

IE also has File System Object (FSO) which can be used.

This isn't a good practice to read file system of a user using javascript and that's a reason why it isn't supported by all browsers.


You should use server-side language to do the same instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM