title: multer not storing image to folder
body: <p>I deployed my express app on heroku and am attempting to upload images using multer. This all works perfectly on localhost but on heroku when I upload an image it will not save to my images folder, and I get a 500 server error with:
   Error: ENOENT: no such file or directory, open '../images/kauai-mountain.jpg'</p>
  
  <p>I am using create react app on front end.</p>
  
  <pre><code>const storage = multer.diskStorage({
      destination: (req, file, cb) =&gt; { 
          cb(error, '../images/');
       },
       filename: (req, file, cb) =&gt; {
           cb(null, file.originalname);
       }
  });
  
  router.post('/', multer({ storage }).single('image'), (req, res) =&gt; {
      const { description, category } = req.body;
      const url = req.protocol + '://' + req.get('host');
  
      const newPost = new Post({
          description,
          category,
          imagePath: url + '/images/' + req.file.filename
      });
  
      newPost.save().then(post =&gt; res.json(post)).catch(e =&gt; res.json(e));
  });
  </code></pre>
  
  <p>server.js</p>
  
  <pre><code>if (process.env.NODE_ENV === 'production') {
      app.use('/images', express.static(path.join(__dirname, 'images')));
      app.use('/', express.static('client/build'));
  
      app.get('*' , (req, res) =&gt; {
          res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html'));
      });
  }
  </code></pre>
  
  <p>My front end code is uploading the image and sending it to the route, the error is in the back end.</p>
  
  <p><strong>EDIT</strong>
  I am reading that the problem may be that heroku cant save images consistently. I don't understand because I am saving them in an images folder on my server which I run on heroku. Could this be the problem?</p>