title: Keep Files on Heroku server with Javascript?
body: <p>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????</p>
  <p>Using Packages:
  express
  express-fileupload</p>
  <p>simple code:</p>
  <p>main.js</p>
  <pre class="lang-js prettyprint-override"><code>app.post('/fileupload',(req,res)=&gt;{
    if (!req.files) {
      return res.status(400).send(&quot;No files were uploaded.&quot;);
    }
    const file = req.files.myFile;
    const path = __dirname + &quot;/files/&quot; + file.name;
  
    file.mv(path, (err) =&gt; {
      if (err) {
        return res.status(500).send(err);
      }
      return res.send({ status: &quot;success&quot;, path: path });
    });
  })
  
  </code></pre>
  <p>terminal command(how i publish the server)</p>
  <pre class="lang-bash prettyprint-override"><code>$ cd myproject
  $ git add .
  $ git commit -m &quot;make it better&quot;
  $ git push heroku master
  </code></pre>
  <p>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?</p>