Sencha ExtJS 7 - How to handle Blob, File, FormData instance object

312 Views Asked by At

How can i send to server a Blob, File and FormData Instance Object using these two way Ext.Ajax.request and Ext.form.Panel.submit?

var blob = new Blob(chunks, {type: chunks[0].type});
var file = new File(["lorem.."], "test.txt", {type: "text/plain"});
var formData = new FormData();
formData.append("text", file);
formData.append("video", blob, "video.webm");

How to add "formData" or simple "blob" and/or "file" into Ext.Ajax.request(options) and Ext.form.Panel.submit(options)?

Another doubt: How to set "file" into value of "filefield" component?

Thanks!

1

There are 1 best solutions below

0
dskalec On

Something in the line of this might work:

Ext.Ajax.request({url: 'https://some.url.com', method: 'POST', rawData: formData, contentType: false})

You can check out this thread as well.