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

282
Views
Keep Files on Heroku server with Javascript?

I am making a server with express to store some files,the site was deployed to heroku.And I found that the file saved on the server will disappear in a few hours.How can I fix that????

Using Packages: express express-fileupload

simple code:

main.js

app.post('/fileupload',(req,res)=>{
  if (!req.files) {
    return res.status(400).send("No files were uploaded.");
  }
  const file = req.files.myFile;
  const path = __dirname + "/files/" + file.name;

  file.mv(path, (err) => {
    if (err) {
      return res.status(500).send(err);
    }
    return res.send({ status: "success", path: path });
  });
})

terminal command(how i publish the server)

$ cd myproject
$ git add .
$ git commit -m "make it better"
$ git push heroku master

I know that I can use tools like S3,but the storage is limited,any free ways like installing npm packages or editing Heroku settings can solve this?

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

0

As far as I know, Heroku does not have persistent storage, meaning if your dynos (server) restart, or go to sleep, then all files are gone. You should save your files somewhere else and retrieve them from the heroku server, for example S3

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!