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

171
Views
Exporting JSON string to file on server

So I'm hosting a localhost website on my raspberry pi with Apache and I'm wondering how would I export a JSON string to a file onto the rpi. I know how to export a file but how would I send the file to the rpi so that I can see it on my file explorer. Right now all it does is make send the JSON to whoever is opening the page, but I need it to be sent to my rpi instead of whoever is opening up the webpage such as my phone or another computer on the network. I can use a web server as long as it's free, there wont be much traffic on the website, so any limitations should be alright. Here's my code for exporting to file:

function download(content, fileName, contentType){
    var a = document.createElement("a");
    var file = new Blob([content], {type: contentType});
    a.href = URL.createObjectURL(file);
    a.download = fileName;
    a.click();
}

and

download(JSON.stringify(data, null, 2), 'json.txt', 'text/plain');

I got this code from stackoverflow but I still haven't been able to find exactly what I'm looking for. PHP is fine but I don't really know how to use it, since I'm kind of a new coder. If I'm missing anything in my questions, comment so that I can fix it, because this is my first question.

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

0

Well, since you're hosting it on Apache, you could try writing some PHP scripts to automatically save the file contents, like file_put_contents() for example.

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!