如题!

解决方案 »

  1.   

    很多JAVA书上都有介绍的还有好多的例子花点时间搜索吧
      

  2.   

    <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
    <%@ page import="com.jspsmart.upload.*"%>
    <jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" /> 
    <html>
    <head>
    <title>上载附件 </title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body>
      <center>正在上传文件...<%//上载附件try
    {mySmartUpload.initialize(pageContext); 
    mySmartUpload.service(request,response); 
    mySmartUpload.upload(); 
    String fn=fn=mySmartUpload.getFiles().getFile(0).getFileName();
    mySmartUpload.save("upload/");//文件保存的目录为upload
    out.println("已经成功上传了文件,请查看<a href=upload/"+fn+">这里</a>,看文件是否上传成功");
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }%>
    <a href=FileUpload.html>重新上传</a>
    </body>
    </html>