I am using node.js and express-busboy to upload a file from a file input form to the server. The uploaded file will have a path of something like root/useruploaded/formattached/somerandomid(e.g. 9w470066-68b4-549e-9607-1987c72768ac)/myFileInputName/uploaded.file
My express-busboy settings look like this:
bb.extend(app, {
upload: true,
path: path.join(__dirname, '/useruploaded/formattached'),
allowedPath: /^\/contact$/ // <-- My POST
});
Then when I access the file by doing req.files.contactFileUpload.filename
I can successfully get the name of the uploaded file.
However, when I go to attach this file to my email, I need the path, which I can't figure out how to get because of the random id folder that busboy puts the user uploaded content into. Otherwise I would be able to do something like
path = path.join(__dirname, '/useruploaded/formattached', req.files.contactFileUpload.filename);
To get the path.
My question is how can I
Stop busboy from putting my files in a random id folder?
OR
Get the full path of the file?
I have tried to do req.files.contactFileUpload.path
, but this returns undefined.
Thank you in advance!