上传碰到这个问题在上传文件的时候同时上传文件的类型。。上网找了半天。总于解决了。。分享一下了。。直接例子了。。
html
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>Uploadify</title>
<link href="plugins/jqueryupload/css/default.css" rel="stylesheet" type="text/css" />
<link href="plugins/jqueryupload/css/uploadify.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript" src="jquery.uploadify.v2.1.0.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#uploadify").uploadify({
'uploader' : 'uploadify.swf',
'script' : '/caobise/three.do?method=upload',
'scriptData' : {'type':$('#ttype').val()},
'cancelImg' : 'plugins/jqueryupload/images/cancel.png',
'folder' : 'upload',
'queueID' : 'fileQueue',
'auto' : false,
'multi' : true,
'simUploadLimit' : 2,
'buttonText' : 'BROWSE'
});
});
</script>
</head>
<body>
<div id="fileQueue"></div>
<select id="ttype" name="ttype" ><option value="1">外文翻译</option><option value="2">文献综述</option><option value="3">开题报告</option> </select>
<input type="file" name="uploadify" id="uploadify" />
<p>
<a href="javascript:$('#uploadify').uploadifySettings('scriptData',{'type':$('#ttype').val()}); jQuery('#uploadify').uploadifyUpload()">开始上传</a>
<a href="javascript:jQuery('#uploadify').uploadifyClearQueue()">取消所有上传</a>
</p>
</body>
</html>
红色部分主要问题所在了。。
在后台使用 request.getParameter("type") 即可!