There was a problem when append multiple uploaded files to FormData.

first, use the upload component of elementUI to save the file to form.picFile and form.corFile respectively, and then new a FormData object at the time of submission, and then append the file, but there is only one file in the data sent. What is the reason, please?

this.param = new FormData();
this.param.append("files", this.form.picFile, this.form.picFile.fileName);
this.param.append("files", this.form.corFile, this.form.corFile.fileName);


modify the answer

clipboard.png

there is no problem with the same key name. Mdn is clearly added with'[] 'just for naming habits. So your current problem may be that when you insert the file for the second time, the parameter that does not have the second parameter in form should not have been obtained yet.
two methods can be tested

.
1.
2.form    

multiple file uploads should be written in this way

data.append('file[]', $('.file')[i].file[0]);

this.param.append('files1', this.form.picFile, this.form.picFile.fileName);
this.param.append('files2', this.form.corFile, this.form.corFile.fileName);
Menu