I am new to Node JS and want to create a server Rest API for images uploading with file name as numeric order (eg. 1, 2, 3, 4).

**server.js**

```
const storage = multer.diskStorage({
  destination: function (request, file, callback) {
    var newDestination = 'dataset/' + request.body.ktp;
    var stat = null;
    try {
      stat = fs.statSync(newDestination);
    } catch (err) {
      fs.mkdirSync(newDestination);
    }
    if (stat && !stat.isDirectory()) {
      throw new Error('Directory cannot be created because an inode of a different type exists at "' + dest + '"');
    }
    callback(null, newDestination);
  },
  filename(request, file, callback) {
    // const extension = path.extname(file.originalname);
    callback(null, Date.now() + '.jpg');
  }
});
const upload = multer({ storage: storage });

app.use('/images', express.static('dataset'));

app.post('/registrasi', upload.array('photos'), function (req, res) {
  const { ktp, nama, namaPerusahaan, alamat } = req.body;

  const uploadInfo = req.files.map(file => {
    return {
      sourceName: file.originalname,
      newName: file.filename,
      ktp: ktp,
      nama: nama,
      namaPerusahaan: namaPerusahaan,
      alamat: alamat
    };
  });
  res.send(uploadInfo);
});

```

My problem is I want to create dynamic file name from uploaded images (eg. 1, 2, 3, 4).
If someone know please help me. Any advice appreciated. Thanks.