使用jspSmartUpload上传文件,提示已经上传了,但就是找不到?
代码:(使用EclipseforJ2EE开发环境)FileUpload.html<html><head><title>FileUpload</title></head><...
代码:(使用Eclipse for J2EE开发环境)
FileUpload.html
<html>
<head>
<title>File Upload</title>
</head>
<body>
<form name = "form1" method = "post" action = "upload.jsp" enctype = "multipart/form-data">
<input type = "file" name = "file1" size = "50"/><br>
<input type = "submit" value = "submit"/>
</form>
</body>
</html>
upload.jsp:
<%@ page language="java" import = "com.jspsmart.upload.*" contentType="text/html; charset=GBK"%>
<html>
<head>
<title>Upload JSP</title>
</head>
<body>
<%
SmartUpload mySmartUpload = new SmartUpload();
int count = 0;
mySmartUpload.initialize(pageContext);
out.println(pageContext.toString()+"<br>");
mySmartUpload.setTotalMaxFileSize(100000);
mySmartUpload.setAllowedFilesList("doc,txt,jpg");
mySmartUpload.upload();
try {
count = mySmartUpload.save("/upload");
out.println(count+" file(s) upload.");
} catch (Exception e) {
e.printStackTrace();
}
%>
</body>
</html> 展开
FileUpload.html
<html>
<head>
<title>File Upload</title>
</head>
<body>
<form name = "form1" method = "post" action = "upload.jsp" enctype = "multipart/form-data">
<input type = "file" name = "file1" size = "50"/><br>
<input type = "submit" value = "submit"/>
</form>
</body>
</html>
upload.jsp:
<%@ page language="java" import = "com.jspsmart.upload.*" contentType="text/html; charset=GBK"%>
<html>
<head>
<title>Upload JSP</title>
</head>
<body>
<%
SmartUpload mySmartUpload = new SmartUpload();
int count = 0;
mySmartUpload.initialize(pageContext);
out.println(pageContext.toString()+"<br>");
mySmartUpload.setTotalMaxFileSize(100000);
mySmartUpload.setAllowedFilesList("doc,txt,jpg");
mySmartUpload.upload();
try {
count = mySmartUpload.save("/upload");
out.println(count+" file(s) upload.");
} catch (Exception e) {
e.printStackTrace();
}
%>
</body>
</html> 展开
3个回答
展开全部
在你的项目目录下搜索你上传的文件名字就能找到你的文件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你在tomcat目录下找这文件
追问
tomcat下没有。
追答
通过组件传到服务器上的文件里的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询