Can I set the dest (upload folder) dynamically?
See original GitHub issueI’d like to upload files to different folder based on user id.
My code is:
const multer = require('multer')
const upload = multer({ dest: 'uploads/'})
app.get('/', function (req, res) {
res.send('Image Extraction Server');
})
app.post('/upload', upload.array('photos',100), (req,res) => {
// get the user id from req
// how can I change the dest path?
res.send('{"status":"ok"}')
})
Is this possible? Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (2 by maintainers)
Top Results From Across the Web
multer: dynamic destination path - node.js - Stack Overflow
6 Answers 6 · 1.Store the file first in a common directory, like /tmp/. · 2.Copy/move the file anywhere you want, to CDN...
Read more >Upload different files in different folders using Multer in NodeJs
Case 1: When you only want to upload files in different folders on the basis of the field name. var upload = multer({storage:assign});...
Read more >input to dynamically set the destination folder (Page 1)
I'm using "multipart_params" to pass my variable to upload.php's file. If variable is static, it works fine, but if variable's dynamic, nothing ......
Read more >dynamic change of the upload folder - WordPress.org
I want to change the upload folder dynamically but I just can't find the solution. How can i change dynamic the folder /CUSTOM....
Read more >Multer create dynamic folder
multer(opts) Multer accepts an options object, the most basic of which is the dest property, which tells Multer where to upload the files....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
pasting the textual version of the same, so that people can copy-paste easily