I try to do a put request to an AWS signed url. When the file is around 50MB it works perfectly fine, no worries. But when the file is like around 200MB or higher, it uploads for 3-4s and then the screen turns white which is I assume a crash. I've got no code like window.reload or something like that anywhere. Been stuck on this for a while now and I don't understand why it's happening.
Here's the code. It's really simple so I don't really get what's going wrong. The create upload path succeeds, after that it goes all wrong.
It works like this in the .html file <input hidden type="file" #fileInput (change)="uploadDraft($event.target.files[0])">
And like this in the .ts file
const reader = new FileReader();
let fileData = {
name: file.name,
lastModified: file.lastModified,
lastModifiedDate: file.lastModifiedDate,
type: file.type,
size: file.size,
}
reader.readAsArrayBuffer(file);
reader.onload = () => {
let _upload: Upload;
this.editorService.createUploadPath(this.event.id, fileData)
.subscribe(
(upload: any) => {
_upload = upload;
console.log(upload)
this.editorService.uploadImage(upload.location, file.type, reader.result).subscribe(
() => {
this.isUploadingDraft = false;
this.notificationService.displayNotification('Upload successful', true);
},
err => {
this.notificationService.displayNotification('Upload failed', false);
this.isUploadingDraft = false;
});
}, () => {
this.isUploadingDraft = false;
this.notificationService.displayNotification('Upload failed', false);
});
}