日期:2014-05-17  浏览次数:20771 次

uploadify3.1上传附件不成功,求解!
用uploadify3.1上次,就是不能成功
代码如下:
单独运行:http://localhost:8080/up 是成功的

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Uploadify</title>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="jquery.uploadify-3.1.min.js"></script>
<link href="uploadify.css" rel="stylesheet" type="text/css" />


<script type="text/javascript">
$(document).ready(
function() {
$("#id_upload").uploadify({ 
'debug':true,
'height' : 30,
'swf' : 'uploadify.swf',
'uploader' : 'http://localhost:8080/up',
'method' : 'post',
'width' : 120,
'method' : 'get',
'cancelImg' : 'cancel.png',
'folder' : 'UploadFile',
'queueID' : 'fileQueue',
'auto' : true,
'buttonClass':'',
'fileSizeLimit':'100KB',
'uploadLimit' : 1,
'multi' : true,
'onDialogClose' : function(queueData) {
alert(1);
}


});
});
</script>

</head>
<body>
<form id="test" name="test" method="post">
<div id="fileQueue"></div>
<input type="file" id="id_upload" name="upload" />
<p>
<a href="javascript:$('#id_upload').uploadify('upload')">上传</a>| <a
href="javascript:$('#id_upload').uploadify('cancle')">取消上传</a>
</p></form>
</body>
</html>

------解决方案--------------------
$("#uploadifyzhiliao").uploadify({
'uploader' : '${pageContext.request.contextPath}/images/uploadify.swf',
'script' : '${pageContext.request.contextPath}/upload.do',
//'scriptData' : {'option':'uploadFile','savereturnid': savereturnid,'compactId':$("#compactId").val()},
//'method' : 'GET',
'cancelImg' : '${pageContext.request.contextPath}/images/cancel.png',
'queueID' : 'fileQueuezhiliao',
'auto' : false,
'multi' : false,
'simUploadLimit' : 1, // The number of simultaneous uploads allowed
//'buttonText' : 'BROWSE'
'buttonImg' : '${pageContext.request.contextPath}/images/upload.png',
'onSelect' : function()
{
$('#fileinfozhiliao').html("");
},
'onComplete' : function (event, queueID, fileObj, response, data)
{
toComplete(event, queueID, fileObj, response, data);
},
'onError' : function(event, queueID, fileObj)
{
$('#fileinfozhiliao').html($('#fileinfozhiliao').html() + "<br\>" + "文件: " + fileObj.name + " 上传失败!");
},
'onCancel' : function(event, queueID, fileObj)
{
$('#fileinfozhiliao').html($('#fileinfozhiliao').html() + "<br\>" + "取消上传文件: " + fileObj.name + "!");
}
});
我的2.1的这样写的,正常上传。。。
------解决方案--------------------
'swf' : 'uploadify.swf',
'uploader' : 'http://localhost:8080/up',
'method' : 'post',
'width' : 120,
'method' : 'get',
你的俩'metho