Reputation: 969
I am using Ext.ux.FileUploadField in Ext JS 3.3.1. I need to get the file data from the form. Does anyone know if this is possible without submitting the form? I can see the filename but not the file data...
Thanks.
Upvotes: 0
Views: 1582
Reputation: 11
// get a handle to the FileUploadField component (e.g. by ID)
var fp = Ext.getCmp('fileUploadField');
//add a handler to FileUploadField's fileselected event
fp.on('fileselected', this.onFileUploadFieldFileSelected, this);
// 'fileselected' event handler
onFileUploadFieldFileSelected : function(fp, fileName) {
// get a handle to the selected file
var selectedFile = fp.fileInput.dom.files[0];
// read the contents of the file using FileReader and display content here
}
Upvotes: 1