Something that web developers have been looking for, but haven't been able to do, is now possible with Google Gears. Namely, accessing a file from JavaScript. It still isn't possible to access an arbitrary file, but with Gears, you can access the contents of a file that the user has selected in a file input element.
The following function assumes the Prototype library.
Given a file input element (DOM reference), the url at which to store the file in the local file store, and a callback to call with the content of the file, it will retrieve the content of the file from the local disk.
Leave a comment