In my Angular 1.x app I have a multiple image upload field. When images are added to the field I want to push some additional data on to the FileList object. I have tried this:
for (var i = 0; i < files.length; i++) {
files[i].append("File", "default_image", true);
}
The format of my 'files' is as follows:
FileList {0: File, 1: File, 2: File, length: 3}
0: File {name: "001.JPG", lastModified: 1521848990762, lastModifiedDate: Fri Mar 23 2018 23:49:50 GMT+0000 (Greenwich Mean Time), webkitRelativePath: "", size: 136430, …}
1: File {name: "002.JPG", lastModified: 1521848990788, lastModifiedDate: Fri Mar 23 2018 23:49:50 GMT+0000 (Greenwich Mean Time), webkitRelativePath: "", size: 136276, …}
2: File {name: "003.JPG", lastModified: 1521848990815, lastModifiedDate: Fri Mar 23 2018 23:49:50 GMT+0000 (Greenwich Mean Time), webkitRelativePath: "", size: 137365, …}
length: 3
There error I get is:
Uncaught TypeError: Cannot read property 'append' of undefined