但为什么在su.upload();这个方法处,就停下了呢?
页面就不动了,文件上传不了。但是也没有异常抛出。郁闷着。
SmartUpload su = new SmartUpload();
su.initialize(pageContext);
su.upload();
su.save("/admin/upload");
<%
response.reset();out.clear();
request.setCharacterEncoding("GBK"); //设置编码方式为GBK
Download down = new Download();
Function Fun = new Function();
String[][] sBig = down.GetAllClass(true, false, null);
String[][] sSmall = down.GetAllClass(false, false, null);
String AdminName = (String) session.getAttribute("AdminName");
String Action = request.getParameter("Action");
String IP = request.getRemoteAddr(); //得到客户端Ip地址
String file_name=request.getParameter("file_name");
String cription=request.getParameter("cription");
String kind=request.getParameter("kind");
if(file_name!=null)
file_name=new String(file_name.getBytes("8859_1"),"GBK");
if (Action != null && Action.equals("Add")) {
SmartUpload su = new SmartUpload();
su.initialize(pageContext);
su.upload();
su.save("../admin/upload");
for (int i = 0; i < su.getFiles().getCount(); i++) {
com.jspsmart.upload.File file = su.getFiles().getFile(i);
file.saveAs("../down/" + file.getFileName(), su.SAVE_VIRTUAL);
// 若文件不存在则继续
if (file.isMissing())
continue;
String[] s = new String[7];
s[0] = file_name;
//request.getParameter("file_name");
s[1]=Integer.toString(file.getSize());
s[2]="67";
s[3] = "down/" + file.getFileName();
s[4]=cription;
s[5]=kind;
String links = down.AddDown(s, AdminName, IP);
if (links.equals("Yes")) {
out
.print("<script>alert('添加下载成功!');location.href='ListDown.jsp';</script>");
return;
} else {
out.print(Fun.OutError(links));
return;
}
}
}
%>
界面如图