Node Multer unexpected field

后端 未结 11 1505
情歌与酒
情歌与酒 2020-12-12 12:17

I\'m working on uploading a file to my app using the multer npm module.

The multer function I have defined is to allow a single file uploaded to the file system. Ev

11条回答
  •  执笔经年
    2020-12-12 13:20

    A follow up to vincent's answer.

    Not a direct answer to the question since the question is using a form.

    For me, it wasn't the name of the input tag that was used, but the name when appending the file to the formData.

    front end file

       var formData = new FormData();
       formData.append('',this.new_attachments)
    

    web service file:

       app.post('/upload', upload.single(''),...
    

提交回复
热议问题