Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

307
Views
How to to save txt file on server in HTML/JS?

I'm making signup form stuff and I want to save data to server and I got this code :

function Signup()
   {
     var text = "hello world",
   blob = new Blob([text], { type: 'text/plain' }),
   anchor = document.createElement('a');

anchor.download = "hello.txt";
anchor
anchor.href = (window.webkitURL || window.URL).createObjectURL(blob);
anchor.dataset.downloadurl = ['text/plain', anchor.download, anchor.href].join(':');
anchor.click();
   }

But its download file and I'm wondering how to save/download it to server.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can't.

The code you have found is for triggering a download and saving a file to the browser's download directory (client-side).

It would be a serious security risk for a web browser to be able to write to arbitrary files on the server.

Instead, create a web service (using the server side programming language of your choice) and make an HTTP request to it (e.g. by submitting a form or using fetch).

Note that for a sign up system, you are almost certainly going to want to save the data to a database and not to a file (that is still a matter for server-side code though).

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!