With AJAXs help it's posible to load data from file, but is it possible to save a value of string variable to file? I want to hold data in file with .txt extension and load it when I will need it.
Asked
Active
Viewed 24 times
-1
-
Yes, just send this string data to your backend file and write this string to an existing file or new file in the backend file. Maybe I am misunderstanding your question. – The One and Only ChemistryBlob Aug 30 '16 at 13:23
-
you can create a datauri.... where are you trying to save the file – Robert Parham Aug 30 '16 at 13:24
-
Which server side language does your application use? – The One and Only ChemistryBlob Aug 30 '16 at 13:26
-
3Possible duplicate of [Javascript: Create and save file](http://stackoverflow.com/questions/13405129/javascript-create-and-save-file) – Aug 30 '16 at 13:27
1 Answers
0
You will need a server side. Assuming you do, send the data back and forth via GET/POST, and edit/save it from the server side. Unless you want the user to pick the file themselves, you can use the FileReader js object with . Otherwise, for security reasons, you cannot. That would give your system access to any user's home directories on their machine.

Caspar Wylie
- 2,818
- 3
- 18
- 32