Ext3下的推荐:http://www.sencha.com/forum/showthread.php?118058-UploadPanel%28Extjs3.0-swfUpload%29
http://czpae86.iteye.com/blog/834123
var setting = {
upload_url : this.uploadUrl,
flash_url : '/OctKms/framework/js/swfupload/swfupload.swf',
file_size_limit : (1024 * 200),// 上传文件体积上限,单位MB
file_post_name : this.filePostName,
file_types : "*.*", // 允许上传的文件类型
file_types_description : "All Files", // 文件类型描述
file_upload_limit : "0", // 限定用户一次性最多上传多少个文件,在上传过程中,该数字会累加,如果设置为“0”,则表示没有限制
file_queue_limit : "10",// 上传队列数量限制,该项通常不需设置,会根据file_upload_limit自动赋值
post_params : {test:'testValue'},
use_query_string : true,
//debug : true,
button_cursor : SWFUpload.CURSOR.HAND,
button_window_mode : SWFUpload.WINDOW_MODE.TRANSPARENT,
custom_settings : {// 自定义参数
scope_handler : this
},
swfupload_loaded_handler : function() {
//console.log("swf组件成功初始化");
},// 当Flash控件成功加载后触发的事件处理函数
file_dialog_start_handler : function() {
//console.log("swf组件正在选取文件");
},// 当文件选取对话框弹出前出发的事件处理函数
file_dialog_complete_handler : function() {
},// 当文件选取对话框关闭后触发的事件处理
upload_start_handler : function() {
},// 开始上传文件前触发的事件处理函数
upload_success_handler : function() {
},// 文件上传成功后触发的事件处理函数
upload_progress_handler : this.uploadProgress,
upload_complete_handler : this.uploadComplete,
upload_error_handler : this.onUploadError,
file_queue_error_handler : this.onFileError,
file_queued_handler : this.onQueued
};
----------------------------------------
说明 this 为swfupload 对象
1.获得post_params: this.settings.post_params
2.设置post_params: this.setPostParams(myvar);
3.获得外部句柄 this.customSettings.scope_handler
疑惑:post_params要从settings这一层找,而scope_handler直接进入到settings里找?
4.向后台参数
There are a couple ways to add post params to an upload.
1. Use the addFileParam() function:
this.addFileParam(file.id, "name", "value");
The added param will only be sent with the specified file.
2. Use the setPostParams() function
this.setPostParams({ name: "value", name2 : "value2" });
This will update the post params sent with all uploads. Calling this function overwrites any previous post param setting you had.