expressjs / expressjs/multer

Multer is not writing the file directly in the folder

Open
#531 5 comments 0 reactions 0 assignees View on GitHub
awaiting more info help wanted
Dominant language
JavaScript
Stars
12.1k
Forks
1.1k
Avg merge
8d 2h
Merged PRs (30d)
21

Description

Hello, I am uploading files dynamically (different folders based on need):

```javascript
// 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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.