Within my Angular 5/Typescript application, there is an UploadFile component structured as follows:
component.html
....
<form #formUpload id="formUpload">
<input type="file" class="input-file-ghost" (change)="onChangeFile($event.target.files)">
</form>
....
component.ts
export class UploadFileComponent implements OnInit {
@Input() .....;
@Output() filesAdded = new EventEmitter<File>();
@ViewChild('formUpload') formUpload: ElementRef;
...
constructor() { .... }
ngOnInit() { .... }
onChangeFile(files: File[]) { ..... }
}
Use case
<app-upload-file
[uploadFileConfig]="...."
(filesAdded)="....">
</app-upload-file>
**********
formCvData: FormData = new FormData();
onFileUploaded($event) {
const uploaded = $event;
this.formLmData.set('.....', uploaded, uploaded.name);
}
The UploadFile component works seamlessly on Chrome and Mozilla browsers. However, when accessed in IE 9, the following error occurs:
'FormData' is undefined
Despite searching through various resources like git issues and Stackblitz projects, a modern solution to fix this issue without relying on jQuery or Ajax has not been found.
IMPORTANT: Seeking assistance for a resolution that eliminates the use of jQuery or Ajax.
Your support and suggestions are highly appreciated.