Is it possible to edit a local file without uploading to the browser?
Let's say the client has an HTML file, I want him to be able to use my site's javascript to edit the file without uploading it. Would this be possible?
Thanks.
Is it possible to edit a local file without uploading to the browser?
Let's say the client has an HTML file, I want him to be able to use my site's javascript to edit the file without uploading it. Would this be possible?
Thanks.
Share Improve this question asked Jan 1, 2011 at 13:50 MarkMark 33.7k34 gold badges108 silver badges139 bronze badges 12- 2 @John - Take a look at HTML5, it is possible now. – Nick Craver Commented Jan 1, 2011 at 14:01
- 1 @Nick: not in all browsers yet – John Saunders Commented Jan 1, 2011 at 14:44
- @John - I agree, but "not in all browsers" is a long cry from "no" :) – Nick Craver Commented Jan 1, 2011 at 17:49
- @Nick: not really. If you can't afford to ignore the browsers without the feature, then the answer, in effect, is "NO". Also, BTW, I get the impression that the OP would like to save the file after it's edited. – John Saunders Commented Jan 1, 2011 at 17:57
- 1 @John - I pletely disagree with your analysis, if for example I'm targeting chrome users the answer is in effect, "YES"...you're making assumptions for all cases here, many will find this question and have very different requirements than you and I on a daily basis. – Nick Craver Commented Jan 1, 2011 at 18:27
2 Answers
Reset to default 4Yes, it is possible, but only in HTML5 (and only as browsers add support for it...not all do yet), you can find the HTML5 File API here.
Note that the user has to give permission to access the file, from Section 5.9:
Once a user has given permission, user agents should provide the ability to read and parse data directly from a local file programmatically.
Nope, that's not possible and shouldn't be either due to security concerns it may pose otherwise.
Note: This feature is there in HTML5 as pointed out by @Nick Craver, you may want to go for but you should be aware of the fact that HTML5 isn't yet supported by all browsers.