Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modifying Local Files Using HTML5 and JavaScript

Is there any way I can use HTML5 and JavaScript to modify a file on my system? I'm OK with running Chrome or Firefox with specific options or opening permissions in some other way.

Ideally I would like test this by having my browser rename a file on my desktop.

like image 455
Kirk Ouimet Avatar asked Jun 23 '11 15:06

Kirk Ouimet


People also ask

Can JavaScript modify local files?

You can't modify local files from Javascript.

Can JavaScript access local files?

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.

Can HTML read local files?

HTML 5 provides a standard way to interact with local files with the help of File API. The File API allows interaction with single, multiple as well as BLOB files. The FileReader API can be used to read a file asynchronously in collaboration with JavaScript event handling.


1 Answers

Yes, you can do this, this link details some of the available functionality:

http://www.html5rocks.com/en/tutorials/file/filesystem/

Just remember, it's not supported in the major browsers yet, and it's likely when it is many of your visitors will not upgrade for quite some time.

like image 72
Jeremy Morgan Avatar answered Oct 25 '22 01:10

Jeremy Morgan