我把smartupload下载下来?可是怎么用?

StefYue 2003-10-16 12:03:50
很多人说好用,可是到底怎么用啊!
我用jsp+tomcap,开发工具是jbuild,
要我把smartupload中的class拷贝到web-int/classes/smartupload
目录下,嘿嘿!jbuild一编译这个目录就没有了。
晕!真不知你们是怎么用的?
...全文
56 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
StefYue 2003-10-16
  • 打赏
  • 举报
回复
我觉得,帅哥你可不可以说的详细一点!!
StefYue 2003-10-16
  • 打赏
  • 举报
回复
我有这些文件!!!!
我是要问下载下来以后,怎样配置????
那篇文章,
“把整个包放到你的WEB-INF文件夹下就可以了”
什么意思?放在那里??还是搞不懂!!
lynx1111 2003-10-16
  • 打赏
  • 举报
回复
http://www.csdn.net/develop/Read_Article.asp?Id=18987
lynx1111 2003-10-16
  • 打赏
  • 举报
回复
<%@ page language="java" import="com.jspsmart.upload.*"%>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
<jsp:useBean id="updateBean" scope="page" class="guest.guest" />
<HTML>
<BODY BGCOLOR="white">

<H1>jspSmartUpload : Sample 2</H1>
<HR>

<%
String name = (String) session.getValue("username");

// Variables
int count=0;

// Initialization
mySmartUpload.initialize(pageContext);

// Upload
mySmartUpload.upload();

// Select each file
for (int i=0;i<mySmartUpload.getFiles().getCount();i++){

// Retreive the current file
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(i);

// Save it only if this file exists
if (!myFile.isMissing()) {

// Save the files with its original names in a virtual path of the web server
myFile.saveAs("/upload/" + myFile.getFileName());
// myFile.saveAs("/upload/" + myFile.getFileName(), mySmartUpload.SAVE_VIRTUAL);

// sample with a physical path
// myFile.saveAs("c:\\temp\\" + myFile.getFileName(), mySmartUpload.SAVE_PHYSICAL);

// Display the properties of the current file
out.println("FieldName = " + myFile.getFieldName() + "<BR>");
out.println("Size = " + myFile.getSize() + "<BR>");
out.println("FileName = " + myFile.getFileName() + "<BR>");
out.println("FileExt = " + myFile.getFileExt() + "<BR>");
out.println("FilePathName = " + myFile.getFilePathName() + "<BR>");
out.println("ContentType = " + myFile.getContentType() + "<BR>");
out.println("ContentDisp = " + myFile.getContentDisp() + "<BR>");
out.println("TypeMIME = " + myFile.getTypeMIME() + "<BR>");
out.println("SubTypeMIME = " + myFile.getSubTypeMIME() + "<BR>");

String FileName="../upload/"+myFile.getFileName();
String strSQL="update guestbook set filename='" + FileName + "' where name='"+ name +"'";
updateBean.executeUpdate(strSQL);

count ++;


}

}

// Display the number of files which could be uploaded
out.println("<BR>" + mySmartUpload.getFiles().getCount() + " files could be uploaded.<BR>");

// Display the number of files uploaded
out.println(count + " file(s) uploaded.");


%>
<%

%>
</BODY>
</HTML>
StefYue 2003-10-16
  • 打赏
  • 举报
回复
呵呵!还有个问题:怎么限制它上传文件的类型
就是后缀名限定为:*.txt的!
谢谢!
StefYue 2003-10-16
  • 打赏
  • 举报
回复
感谢各位相助!谢谢!给分了
lynx1111 2003-10-16
  • 打赏
  • 举报
回复
1。把com文件夹放在WEB-INF/classes下
2。在jsp文件同级目录下新建upload文件夹(myFile.saveAs("/upload/" +myFile.getFileName());)
3。代码如果不写数据库,就把涉及数据库部分删掉!

StefYue 2003-10-16
  • 打赏
  • 举报
回复
http://www.csdn.net/develop/Read_Article.asp?Id=18987
我设置上传目录:
String aa=getServletContext().getRealPath("D:\\upload");

保错:
org.apache.jasper.JasperException: This path does not exist (1135).
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause

java.lang.IllegalArgumentException: This path does not exist (1135).
at com.jspsmart.upload.SmartUpload.getPhysicalPath(SmartUpload.java:1128)
at com.jspsmart.upload.File.saveAs(File.java:91)
at org.apache.jsp.upload_jsp._jspService(upload_jsp.java:75)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

黑马 2003-10-16
  • 打赏
  • 举报
回复
就是把下载的包放到tomcat的yourweb/web_info/classes/下即可

81,090

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧