I'm writing an offline webapp that allows user to select local file, modify it and than saves a copy also locally. Is it possible without any server (I can upload a file and return base64 of it, but it's not much of a offline)? App needs to work only on Google Chrome, so maybe I should look here?
Asked
Active
Viewed 8,806 times
3 Answers
3
The HTML5 File API might prove usefull

ChrisR
- 14,370
- 16
- 70
- 107
-
This specification currently allows files only in the user sandbox. :( – Microfed Nov 09 '11 at 22:06
-
HTML5 is the future! Use this for future development – Skeen Apr 10 '14 at 23:19
2
input = document.getElementById(inputId);
var reader = new FileReader();
reader.onload = function (e) {
base64 = e.target.result;
};
reader.readAsDataURL(input.files[0]);
where input is an element <input type='file'></input>
. Also works for an input that can select multiple files.

Rhys van der Waerden
- 3,526
- 2
- 27
- 32

GAgnew
- 3,847
- 3
- 26
- 28
-1
To work with files in the browser I use downloadify. In order to make it work with paths containing "file://" you need to allow for downloadify.swf access to the file system on the settings.

Microfed
- 2,832
- 22
- 25
-
I guess that you're downvoted because the OP stated "without any server", and someone saw `file://` in your answer. Here, have a +1 for 0. – Rob W Nov 09 '11 at 22:38
-
There is no server. "file://" appeared here because of Adobe security policy. SWF-file is compiled for the network or to work with the local file system. The downloadify.swf is compiled to work with the network, so there is limited access to the file system. – Microfed Nov 09 '11 at 22:58
-
1