is it poss开发者_C百科ible to upload file without form submit using extjs 4? what is the way to do that?
Regards
Yes it's possible. You can do it with Ajax and FormData API:
var file = s.fileInputEl.dom.files[0],
data = new FormData();
data.append('file', file);
Ext.Ajax.request({
url: '/upload/files',
rawData: data,
headers: {'Content-Type':null}, //to use content type of FormData
success: function(response){
}
});
See online demo here
Use 'filefield' control of Extjs 4. and check below links
http://docs.sencha.com/ext-js/4-0/#/api/Ext.form.field.File
http://docs.sencha.com/ext-js/4-0/#/api/Ext.form.field.Field-method-isFileUpload
I didn't check the same but i think it should help.
Thanks, Kunal
精彩评论