title: Express js- how to send full path to client with multer
body: <p>I use multer to save the names of the pictures in separate folders in storage․ I want to send the client not only the name of the file, but also connect the path to the folder to it. For example: {icon: 'storage/categories/name'}, how to dynamically set it up? My middleware is this:</p>
  <pre><code>const multer = require('multer');
      
      module.exports = function (directory){
          const storage = multer.diskStorage({
              destination(req, file, cb){
                  cb(null, `storage/${directory}`)
              },
              filename(req, file, cb){
                  cb(null, new Date().toISOString().replace(/:/g, '-') + file.originalname)
      
              }
          })
      
          const types = ['image/png', 'image/jpeg', 'image/jpg']
      
          const fileFilter = (req, file, cb) =&gt; {
              if (types.includes(file.mimetype)) {
                  cb(null, true)
              } else {
                  cb(null, false)
              }
          }
      
          return multer({storage, fileFilter})
      }
  </code></pre>