can I upload Blob object using ng2-file-upload? #998

Open
opened 2018-03-26 06:57:42 +00:00 by ZikZakJainy · 1 comment
ZikZakJainy commented 2018-03-26 06:57:42 +00:00 (Migrated from github.com)

I am using cropper tool and cropper return Base 64 result, I convert that to Blob object and now, I want to upload Blob object to the Server. how can I upload my Blob object to the server is there any way to upload?

I am using cropper tool and cropper return Base 64 result, I convert that to Blob object and now, I want to upload Blob object to the Server. how can I upload my Blob object to the server is there any way to upload?
koenvanderlinden commented 2018-03-29 13:37:07 +00:00 (Migrated from github.com)

Try this:

let blob: Blob = new Blob(["somedata for the blob"]);
let fileFromBlob: File = new File([blob], "somefileNameFromBlob.txt");
this.uploader.addToQueue(new Array<File>(fileFromBlob));
this.uploader.uploadAll()
Try this: ``` let blob: Blob = new Blob(["somedata for the blob"]); let fileFromBlob: File = new File([blob], "somefileNameFromBlob.txt"); this.uploader.addToQueue(new Array<File>(fileFromBlob)); this.uploader.uploadAll() ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#998