ファイルアップロード機能についてextjs4で作業しています。ビューを次のようにコーディングしました-
Ext.define('Balaee.view.kp.dnycontent.Content',
{
extend:'Ext.form.Panel',
requires:[
'Balaee.view.kp.dnycontent.ContentView'
],
id:'ContentId',
alias:'widget.Content',
title:'This day in a history',
items:[
{
xtype: 'fileuploadfield',
hideLabel: true,
emptyText: 'Select a file to upload...',
//inputType: 'file',
id: 'upfile',
//name:'file',
width: 220
}],
buttons: [{
xtype : 'button',
fieldlabel:'upload',
action:'upload',
name:'upload',
text: 'Upload',
formBind:'true'
}]
});
そして、コントローラーでファイルを取得するために、コードを次のように記述しました-
getUpload : function() {
var fileobj = Ext.getCmp('upfile');
var file10 = Ext.getCmp('ContentId').getEl().down('input[type=file]').dom.files[0];
var reader = new window.FileReader();
reader.onload = function(oFREvent) {
fileobj=oFREvent.target.result;
console.log(oFREvent.target.result);
};
var storeObj=this.getStore('kp.DnycontentStore');
console.log(storeObj);
storeObj.load({
params:{
data:file
},
callback: function(records,operation,success){
console.log("send");
},
scope:this
})
console.log(storeObj);
}
});
上記の「 var file10 = Ext.getCmp('ContentId').getEl().down('input[type=file]').dom.files[0];」行はすべてのファイル関連データを次の"File{size=879394,type="image/jpeg",name="Chrysanthemum.jpg", more...}"
ように取得しています-では、アップロードされたファイルの実際のコンテンツを取得してアクセスするにはどうすればよいですか? 私を助けてください