title: nodejs multer retrieve stored images to the client side
body: <p>I have created file storage in nodejs application to store images in uploads folder. which works fine but now I want to display those images I have read some other posts but I am still quite unsure.</p>
  
  <p>Here is my code:</p>
  
  <pre><code> var Storage = multer.diskStorage({
   destination: function(req, file, callback) {
   var pathname = file.originalname;
   var path = pathname[0].replace('_','/');
   cb(null,'./uploads'+pathname);
   },
   filename: function(req, file, callback) {
   var pathname = file.originalname;
   var filename = pathname[1];
   if(pathname!=undefined)
   callback(null, pathname);
   }
   });
   var upload = multer({ storage: Storage }).single('file');
  
  router.post('/upload', multer({dest:'./uploads/'}).single('file'), function(req,res)
   {
   return res.status(201).json({result:req.file});
   });
  </code></pre>
  
  <p>from console log I get </p>
  
  <pre><code>{ fieldname: 'file',
    originalname: '1569402978357.jpg',
    encoding: '7bit',
    mimetype: 'image/jpeg',
    destination: './uploads/',
    filename: 'ada9282345565e8a77c6adc4b2d15836',
    path: 'uploads\\ada9282345565e8a77c6adc4b2d15836',
    size: 170272 }
  </code></pre>
  
  <p>and in the uploads it is stored as filename </p>
  
  <p>my problem is how can I display this image back? should call it from stored filename or should I change the storage to save it as original filename with file extension?</p>