Issue
Can anybody tell me why IE11 is throwing error at the last line -
this.document = this.control.value;
const bytes =
this.documentService.base64toBytes(this.document.documentBlob.documentData,
this.document.documentDataFormat);
const file = new File(bytes, this.document.documentName, { type:
this.document.documentDataFormat });
This is working in both Chrome and Firefox.IE throws object error -
Object doesn't support this action.
Solution
As IE does not support constructor of File API, I have come up with the following workaround. Hope this helps to others in future -
const bytes = this.documentService.base64toBytes(this.document.documentBlob.documentData, this.document.documentDataFormat);
let file: File;
try {
file = new File(bytes, this.document.documentName, { type: this.document.documentDataFormat });
if (this.uploader.isFile(file)) {
this.uploader.addToQueue([file]);
}
} catch (err) { // Workaround for IE 11
const blob = this.documentService.base64ToBlob(this.document.documentBlob.documentData,
this.document.documentDataFormat);
file = this.documentService.blobToFile(blob, this.document.documentName);
this.uploader.addToQueue([file]);
Answered By - Mayeed
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.