I've seen some posts regarding access to files on a client machine by a webpage, namely this question.
I'm trying to hop on the "continuously update in the cloud" paradigm for some algorithms I am writing so my users can access the latest versions by simply accessing the webpage. This requires that the program/webpage can start with a directory and recursively inspect files within it and compute results based on what is found. In the end it also should be able to write the results file to the client's filesystem.
One of the answers in that previous question mentions Google Gears but that has since been discontinued in favor of HTML5. Is access to a client directory possible within HTML5? How?
I know why access by any webpage to local files is a security risk, but for my purpose I have no problem to ask the user for the appropriate permissions.
Web browsers (and JavaScript) can only access local files with user permission. To standardize the file access from the browser, the W3C published the HTML5 File API in 2014. It defines how to access and upload local files with file objects in web applications.
JavaScript cannot typically access local files in new browsers, but the XMLHttpRequest object can be used to read files. So it is actually Ajax (and not Javascript) which is reading the file.
HTML can be used to open a folder from our local storage. In order to open a folder from our local storage, use 'HREF' attribute of HTML. In the HREF attribute, we specify the path of our folder.
Using Google Chrome to access local files is as easy as pressing Ctrl + O at the same time. This interface will open, allowing you to navigate to whichever file or folder is needed.
No, not directly at least. However, you have a number of choices here.
Currently your best choices are:
multiple
attribute to read and open multiple files at once without having to have separate fields.Chrome 6 also will support the File API
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With