我正在使用uploadify上传文件
有jsp代码
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/tags.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
<html>
<head>
<link href="${path }/css/uploadify.css" rel="stylesheet" />
<script type="text/javascript" src="${path }/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="${path }/js/swfobject.js"></script>
<script type="text/javascript" src="${path }/js/jquery.uploadify.min.js"></script>
<script>
$("#uploadify").uploadify( {
'swf' : '${path }/js/uploadify.swf',
'uploader' : '${path }/js/uploadify.swf',
'script' : '${path }/sys/addImage',
'queueID' : 'fileQueue',
'queueSizeLimit' : 5,
'fileTypeDesc' : 'exts',
'fileTypeExts' : '*.bmp;*.jpg;*.jpeg;*.png',
'method' : 'post',
'fileSizeLimit' : 10000,
'auto' : false,
'multi' : true,
'uploadLimit' : 5,
'buttonText' : 'browse',
'onUploadError' : function (file, errorCode, errorMsg, errorString) {
alert("errorCode:" + errorCode + "\n" + "errorMsg:" + errorMsg + "\n" + "errorString:" + errorString);
},
'onUploadSuccess' : function (file, data, response) {
$('#sendDialog').dialog('close');
$('#listTable').datagrid('reload');
}
});
</script>
</head>
<body>
<div id="fileQueue"></div>
<input type="file" name="fileupload" id="uploadify" />
</body>
</html>
和 Struts 动作代码
@Namespace("/sys")
@Controller
public class ImageAction extends BaseAction {
private File fileupload;
private String fileuploadFileName;
public File getFileupload() {
return fileupload;
}
public void setFileupload(File fileupload) {
this.fileupload = fileupload;
}
public String getFileuploadFileName() {
return fileuploadFileName;
}
public void setFileuploadFileName(String fileuploadFileName) {
this.fileuploadFileName = fileuploadFileName;
}
@Action(value = "addImage")
public void addImage() {
String newFileName = "", extName = "";
String savePath = request.getSession().getServletContext().getRealPath("/");
savePath = savePath + getImgFloder();
if (fileuploadFileName.lastIndexOf(".") >= 0) {
extName = fileuploadFileName.substring(fileuploadFileName.lastIndexOf("."));
}
newFileName = savePath + UUID.randomUUID().toString() + extName;
fileupload.renameTo(new File(newFileName));
}
}
我在顶行设置了一个断点addImage()
当我选择一些文件并执行$("#uploadify").uploadify('upload','*');
事件onUploadSuccess
被触发,但断点未被触发
如何解决?