0

I want to save a javascript string variable into a .txt file by clicking on save button. By clicking on save button it should open a prompt where the user can enter the filename and able to save that file in any location in local pc.

So how can i do this?

2
  • where is your code? Commented Aug 11, 2016 at 12:43
  • I think you cannot save that file in any location in local pc. I think you can only write to the sandboxed filesystem Commented Aug 11, 2016 at 12:53

1 Answer 1

1

You can do it as

  • Save javascript string into a variable
  • Create a new file using js and assign that file name using that variable string
  • close the file.
Sign up to request clarification or add additional context in comments.

4 Comments

rarely have I seen an answer that makes such a vague question look so good
Lol..I just mentioned the steps to make his way easy.. :)
By this I can create only one file, if I want create multiple files then I have perform multiple file operations, instead of that by clicking on save it should open an save prompt where user can be able to give different name to the file and able to save it in any location in local pc. So how this can be done?]
Well I don't understand what exactly you want to built..! You can use bootstrap modal and use text field in it where you can enter file name etc etc.. and on save you can perform operations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.