Search code examples
javascripthtmlfunctionwritefile

How to write the form information to a local txt archive using javascript/jquery?


I need to write a js function to write the form information into a .txt

i will not use database in this project, i will use .txt files to control everything, products, person, employee , etc. All they will be at a .txt called control.txt with the information like this:

[person]name|email|date

[employee]name|department

So i need a function that writes the form information into my .txt archive.


Solution

  • You can't.

    Think this through for a minute, you want javascript code on a users computer to be able to directly edit a file on your webserver.

    The security risks of allowing writing to arbitrary files on a server would be insane. Not to mention handling conflicts with multiple clients.

    There is a reason why databases are used. If you want to modify data on a server you need some kind of server side layer.