`

SWFUpload向服务器传递参数

阅读更多
SWFUpload传递参数有3中方式:

1、在url后加连接:

upload_url: "<%=basePath%>upload?action=up",

2、使用swfupload传递参数,在setting中配置

post_params: {
				"hello" : "Here I Am",
				"name" : "张三",
				"ff" : document.getElementById("tf").value
			},

use_query_string : true,//要传递参数用到的配置


3、采用swfupload的函数:

addPostParam("myFileName",encodeURI(file.name));//这个是我用来传递文件名称的


我的方法是修改了一下uploadStart函数
function uploadStart(file) {
	try {
		/* I don't want to do any file validation or anything,  I'll just update the UI and return true to indicate that the upload should start */
		var progress = new FileProgress(file, this.customSettings.progressTarget);
		
		//progress.setStatus("Uploading...");
		progress.setStatus("上传中...");
		progress.toggleCancel(true, this);
		this.setPostParams({ 
			  'fileName':encodeURIComponent(file.name) 
			  }); 
	}
	catch (ex) {
	}
	
	return true;
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics