开发者

is it possible to upload file without form using extjs 4?

开发者 https://www.devze.com 2023-03-21 04:42 出处:网络
is it poss开发者_C百科ible to upload file without form submit using extjs 4? what is the way to do that?

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

0

精彩评论

暂无评论...
验证码 换一张
取 消