Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

283
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda