I am facing a strange issue, with my express server: I want download a file inside a folder that is created at run-time; this is my code:
var folder = id.toString()
var file = [projectRoot,"/app/temp/",folder, "/registrazioni.zip"].join("")
console.log('file',file)
res.download(file,'registrazioni.zip')
I know that all the variables are defined, but res.download raise an error:
{ [Error: ENOENT: no such file or directory, stat '/home/giuseppe/projects/csgSAW/app/temp/undefined/registrazioni.zip']
errno: -2, code: 'ENOENT', syscall: 'stat', path: '/home/projects/csgSAW/app/temp/undefined/registrazioni.zip', expose: false, statusCode: 404, status: 404 }
where I should see the folder, got undefined, but the consolo.log just before res.download is correct, so I am very puzzled, do notr know what is wrong. I am working with node 4.2.6 and express ^4.14.0, thanks in advance
id
? Yourfolder
isundefined
, as you can see in the path (.../temp/undefined/registrazioni.zip
). – Benni