是否可以使用extjs 4上传没有表单提交的文件? 这样做的方法是什么?
此致
答案 0 :(得分:1)
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
我没有检查相同,但我认为它应该有所帮助。
谢谢, 库纳尔
答案 1 :(得分:1)
是的,这是可能的。您可以使用Ajax和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){
}
});
参见在线演示here