expressjs/multer

Multer is not writing the file directly in the folder

Open

#531 创建于 2017年10月5日

在 GitHub 查看
 (5 评论) (0 反应) (0 负责人)JavaScript (1,043 fork)batch import
awaiting more infohelp wanted

仓库指标

Star
 (11,136 star)
PR 合并指标
 (平均合并 9天 11小时) (30 天内合并 7 个 PR)

描述

Hello, 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?

贡献者指南