Creating and saving file in Javascript | Sololearn: Learn to code for FREE!

+1

Creating and saving file in Javascript

How can a create and save a file(e.g txt) into the web users pc

6/6/2018 2:27:35 PM

steve

3 Answers

New Answer

+7

steve You cant directly save it with javascript but you can force the user to download it. To create file you should take a look at ”Blob” thingy https://developer.mozilla.org/en-US/docs/Web/API/Blob Would be easier with server side.

0

Browsers do not allow web scripts like JavaScript to store any files into local pc due to security reasons. You can only use local storage functions to store script variables in local pc.

0

inspite of that how i create the file...maybe i ll just upload it to the sever