I am using the file uploader in extjs 'fileuploadfield' (Ext.form.field.File), and in my button handler I would like to upload it as base64
handler: function(){
if(self.getForm().isValid()){
self.getForm().submit({
url: myURL,
headers: {
'Accept': 'application/json; charset=utf-8'
},
I would like something like this :
handler: function(){
if(self.getForm().isValid()){
var f = self.getForm().getFileStream();
var base64 = convertToBase64(f);
var params = {};
params.base64 = base64;
Ext.Ajax.request({
params: params,
scope: this,
url: myURL,
method: 'POST',
callback: function (options, success, response) {
}
)
}
Where would I get the file data from the form object? What can I used to convert to base64? Does my logic seem correct in how I am approaching this problem?