欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

SWFUpload向服务器传递参数

程序员文章站 2022-04-17 20:13:30
...
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;
}