文件上传时的故障,请高手指点

hxs0117144 hxs0117144 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我的处理页面代码如下:
<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %>
<%@ page import="java.util.*,com.jspsmart.upload.*" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.text.SimpleDateFormat;"%>
<html>
<head>
<title>文件上传处理页面</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
SmartUpload file1 = new SmartUpload();
file1.initialize(pageContext);
file1.upload( );

Date date=new Date();
String dateFormatStr="yyyyMddHmmssSS";
SimpleDateFormat simpleFormat=new SimpleDateFormat(dateFormatStr);
String datetime=simpleFormat.format(date);
com.jspsmart.upload.File myFile = file1.getFiles().getFile(0);
myFile.saveAs("/imag/"+ datetime+"."+myFile.getFileExt());
out.println("文件上传成功!<hr>");
%>
</body>
</html>




编译时为何出现下列信息:

org.apache.jasper.JasperException: An exception occurred processing JSP page /Da.jsp at line 14

11: <%
12: SmartUpload file1 = new SmartUpload();
13: file1.initialize(pageContext);
14: file1.upload( );
15:
16: Date date=new Date();
17: String dateFormatStr="yyyyMddHmmssSS";


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

java.lang.NegativeArraySizeException
com.jspsmart.upload.SmartUpload.upload(SmartUpload.java:218)
org.apache.jsp.Da_jsp._jspService(Da_jsp.java:70)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


...全文
评论 9
收藏 已收藏
分享
返回顶部
hxs0117144
Web 开发 81,108 成员 341,721 内容