Multer is not writing the file directly in the folder
See original GitHub issueHello, I am uploading files dynamically (different folders based on need):
// Configure multer
let upload = multer({
storage: multer.diskStorage({
destination: (req, file, callback) => {
let homefolder = req.body.folder;
callback(null, homefolder);
},
filename: (req, file, callback) => {
let filename = req.body.filename;
callback(null, filename);
}
})
});
router.post('/upload', upload.single('file'), ctrlFileUploader.upload);
This is working well, the issue I have noticed is that multer doesn’t write the file there exactly, it kinda waits for the file to be uploaded completely and then starts writing the file to the folder. Is this normal or I am doing something wrong?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
node.js - Multer storage is not uploading file on server directory
Try to use the absolute path to the storage location: cb(null, require('path').join(__dirname, '..', 'resources', 'uploads'));. instead:
Read more >Multer: Easily upload files with Node.js and Express
Multer is a Node.js middleware for handling multipart/form-data that ... First, create a folder called file-upload-example , then create ...
Read more >File Upload Using Multer in Node.js and Express.js
Here is a step-by-step guide to build a demo application for image and video file upload using Multer in NodeJS and Express from...
Read more >File uploads using Node.js - CodeForGeek
You need to add that folder as a static path where your file is getting uploaded and once the client is trying to...
Read more >Upload files to the Node.js server with Express and Multer
We can view the file now but, there is an issue we need to know about. We are exposing a folder of our...
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
@LinusU I’ll do that an report back what I found.
If someone can try and repro this, or link an issue if this has been investigated, that would be 💯