0

all uploded file name are encrypted , so when i want to download those file i am changing file name with there actual file name which are saved in data base, below code should work but not in my case, how to change file name while downloading

below is my code for it

res.setHeader('Content-Disposition', 'attachment;filename="' + fileName + '"');
res.setHeader('Content-Type', 'image/jpg' );
res.download(filepath);

any help will b appreciated , please suggest

pitu
  • 822
  • 3
  • 11
  • 35

1 Answers1

-1

res.download() not working in my case

res.get('/download', function(req, res) {
  res.download(__dirname + 'jsonFile.json', 'jsonFile.json');
});
Community
  • 1
  • 1
pitu
  • 822
  • 3
  • 11
  • 35