Extjs 使用ajax上传文件,解决Object #<HTMLDivElement> has no method 'submit'
来源:互联网 发布:淘宝购物车不能用 编辑:程序博客网 时间:2024/06/03 05:26
1、使用isUpload上传文件,并不是通过XMLHttpRequests进行上传的,extjs的实现原理是通过隐藏的iframe进行提交。
ExtJs通过强大的内部封装,使ajax请求看起来可以直接提交二进制流数据。每当提交文件数据时,ExtJs会自动创建iframe,在iframe中提交。提交完成 后又自动移去,一切显得天衣无缝。
2、前台js代码,跟普通ajax就多了,form:"form表单ID" ,isUpload: true
<h1>Ajax文件上传</h1> <div class="content" id="div2"> <form id="form1"> 请选择文本文件:<input type="file" name="file" /> <input type="button" id="button1" value="上传" /> </form> </div>
//文件上传 Ext.get("button1").on("click", function () { Ext.Ajax.request({ url: "Ajax_FileUp", isUpload: true, form: "form1", success: function (response) { Ext.MessageBox.alert("上传成功,文本文件内容:", response.responseText); } }); });
注意ajax中配置的form,必须是html中存在的form的id,而不是Ext.form.Panel的id
var form1=Ext.create('Ext.form.Panel',{
id:'form1',
id:'form1',
- Extjs 使用ajax上传文件,解决Object #<HTMLDivElement> has no method 'submit'
- Uncaught TypeError: Object #<HTMLDivElement> has no method 'attr'
- 当使用JQuery的"$",抛异常Uncaught TypeError: Object #<Object> has no method 'ajax'
- has no method 'ajax'
- Object [object Object] has no method 'tree'
- TypeError: Object #<Object> has no method 'createClient'
- 手机使用jqueryMobile,提示jquery mobile: Object [object Object] has no method 'jqmData'
- webview 错误 Object has no method clickOnAndroid
- Uncaught TypeError: Object [object Object] has no method 'live'
- jquery: Uncaught TypeError: Object [object Object] has no method 'live'
- Uncaught TypeError: Object [object Object] has no method 'xxx'
- canvas Object [object Object] has no method 'getContext'
- Uncaught TypeError: Object [object Object] has no method 'highcharts'
- jsp Object [object Object] has no method 'datebox'
- ExtJs使用ajax跨域上传文件
- EXTJS 使用Ajax跨域上传文件
- Uncaught TypeError: Object #<Object> has no method 'addEvents'
- Uncaught TypeError: Object #<Object> has no method 'addEvents'
- Android移动存储方案
- osg for android 学习之八:关于StateSet
- 脚本中的innerText和innerHtml和value的区别
- oracle中的几个重要进程
- 设计模式
- Extjs 使用ajax上传文件,解决Object #<HTMLDivElement> has no method 'submit'
- 拿ipython当shell用
- android 中使用socket使native和framework通信
- GridPanel中的loadMask在页面第一次加载不显示的问题
- 读完云风的"那些日子"的一些感想
- Hive 安装
- setNeedsDisplayInRect 小议
- 排序算法--希尔排序C++实现
- 企业即时通讯 智能教学利器