Ext.ux.UploadDialog.Dialog多文件上例子
来源:互联网 发布:二手车交易数据下载 编辑:程序博客网 时间:2024/05/30 22:43
1.在jsp页面的添加上传地方添加函数
Ext.ux.UploadDialog 像ext一样展现给用户震撼的界面:
如图:上传之前
上传过程中:
强悍吧。怎样使用呢。?
自己去搜索 Ext.ux.UploadDialog.包下载
使用是出来导入必要的ext包还需要
<link rel="stylesheet" href="Ext.ux.UploadDialog/UploadDialog/css/Ext.ux.UploadDialog.css" />
<script type="text/javascript" src="Ext.ux.UploadDialog/Ext.ux.UploadDialog.packed.js"></script>
使用很简单 弄个onclick事件 核心代码如下
1.function insertImages()
2.{
3. dialog = new Ext.ux.UploadDialog.Dialog({
4. title: '文件上传__上传过程中关闭窗口,不影响上传_wayfoon',
5. url:wayfoon.MMS.DataPage +'/xxx.action?action=xxx',
6.
7. width : 450,
8. height : 300,
9. minWidth : 450,
10. minHeight : 300,
11. draggable : true,
12. resizable : true,
13. //autoCreate: true,
14. constraintoviewport: true,
15. permitted_extensions:['JPG','jpg','jpeg','JPEG','GIF','gif','bmp','BMP'],
16. modal: true,
17. //post_var_name: 'mms',
18. reset_on_hide: false,
19. allow_close_on_upload: true, //关闭上传窗口是否仍然上传文件
20. upload_autostart: false //是否自动上传文件
21. });
22.
23. dialog.show();//'show-button'
24. dialog.on('uploadsuccess', onUploadSuccess);
25.
26.}
提交时,默认提交的文件名是file 你可以修改 post_var_name: 'myfile',
dialog 有很多事件,如下英文。例子中使用了uploadsuccess事件
•filetest - fires before file is added into the queue, parameters:
dialog - reference to dialog
filename - file name
If handler returns false then file will not be queued.
•fileadd - fires when file is added into the queue, parameters:
dialog - reference to dialog
filename - file name
•fileremove - fires when file is removed from the queue, parameters:
dialog - reference to dialog
filename - file name
record - file record
•resetqueue - fires when upload queue is resetted, parameters:
dialog - reference to dialog
•beforefileuploadstart - fires when file as about to start uploading:
dialog - reference to dialog
filename - uploaded file name
record - file record
If handler returns false then file upload will be canceled.
•fileuploadstart - fires when file has started uploading:
dialog - reference to dialog
filename - uploaded file name
record - file record
•uploadsuccess - fires when file is successfuly uploaded, parameters:
dialog - reference to dialog
filename - uploaded file name
data - js-object builded from json-data returned from upload handler response.
record - file record
•uploaderror - fires when file upload error occured, parameters:
dialog - reference to dialog
filename - uploaded file name
data - js-object builded from json-data returned from upload handler response.
record - file record
•uploadfailed - fires when file upload failed, parameters:
dialog - reference to dialog
filename - failed file name
record - file record
•uploadcanceled - fires when file upload canceled, parameters:
dialog - reference to dialog
filename - failed file name
record - file record
•uploadstart - fires when upload process starts, parameters:
dialog - reference to dialog
•uploadstop - fires when upload process stops, parameters:
dialog - reference to dialog
•uploadcomplete - fires when upload process complete (no files to upload left), parameters:
dialog - reference to dialog
注意该多文件上传,每次其实只上传了一个文件,多个文件是分多次上传的。
看到了有很多后台代码采用了多文件 循环读取,只是没有必要的,我们只要当一个文件处理就可以了。
网上很多例子,也只能称为例子,离应用还有点距离,应用的时候,还需要灵活点
比如我们需要传入自己的参数,网上很难找到,其实我们可以在事件中来改变 提交的参数,
采用属性 base_params:{ hehe: "wayfoon" } 来实现,
function onUploadSuccess(dialog, filename, resp_data, record)
{
你可以改变dialog的某些值
resp_data 是返回的json数据
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/wayfoon322/archive/2008/12/17/3541095.aspx
2.后台处理代码
3.文件上传的同时进行重命名
- Ext.ux.UploadDialog.Dialog多文件上例子
- 用Ext.ux.UploadDialog.Dialog生成“多文件上传的窗口”,怎么会有错误。
- 利用Ext.ux.UploadDialog异步实现多文件上传
- Ext.ux.UploadDialog 整合 Struts2 实现多文件上传
- 利用Ext.ux.UploadDialog实现异步多文件上传
- 应用Ext.ux.UploadDialog上传文件
- 应用Ext.ux.UploadDialog上传文件
- ext 多文件上传控件 Ext.ux.UploadDialog 使用中的问题
- ext 多文件上传控件 Ext.ux.UploadDialog 使用中的问题
- Ext.ux.UploadDialog 控件使用说明及在Ext 3.x下问题解决
- Ext.ux.UploadDialog 中底部工具条BottomToolbar 不显示的问题
- ext3.4 实现多文件上传UploadDialog
- Ext.ux.uploaddialog3.0上传文件乱码问题
- EXTJS FILE UploadDialog用JAVA实现例子
- ext.ux.form.lovcombo
- Ext.ux.itemselector 使用
- Ext.ux.data.DwrProxy
- ExtJs文件上传组件(UploadDialog)
- About IPC
- Spectral Clustering[谱聚类]
- Servlet API——Servlet接口的简述
- java编译环境配置
- C 语言破解神奇读心术
- Ext.ux.UploadDialog.Dialog多文件上例子
- 在j2me应用里用json.me解析json
- struts 2 s:标签
- 网页图片预加载用js实现
- Juce源码分析-弱引用(1)
- servlet生命周期
- c# 中关于正则表达式的用法总结(很全面)
- google搜索技巧
- 正则表达式学习(三)