Reputation: 73
var formData = new FormData();
formData.append("file1",file1.files[0]);
formData.append("file1",file2.files[0]);
formData.append("file1",file3.files[0]);
formData.append("file1",file4.files[0]);
On controller I am getting only one file.
Please help
Upvotes: 1
Views: 556
Reputation: 22992
You are appending the files with the same name file1
everytime, so at the end you end up with just one file. You need to assign a unique name to each file.
var formData = new FormData();
formData.append("file1",file1.files[0]);
formData.append("file2",file2.files[0]);
formData.append("file3",file3.files[0]);
formData.append("file4",file4.files[0]);
Upvotes: 1