用 smartupload .
<%@ page import="java.sql.*"%>
<%@ page import="java.lang.*" %>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
<jsp:useBean id="sqlbean" scope="page" class="beans.sql_data"/>
<%
mySmartUpload.initialize(pageContext);
mySmartUpload.upload();
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
if (!myFile.isMissing())
  {

             String myfilename= null;
             String sql="";
             myfilename=myFile.getFileName();
     String fname =myFile.getFileName();
     String  suffix=myfilename.substring(0,myfilename.lastIndexOf('.'));
             String explain=(String)mySmartUpload.getRequest().getParameter("text");
             explain=new String(explain.getBytes("ISO8859-1"),"GB2312");
             String ts="/product/"+fname;
             myFile.saveAs(ts);
     
      }

解决方案 »

  1.   

    smartupload下载:
    www.jspsmart.com
      

  2.   

    smartupload是好东西
    大家用的最多
      

  3.   

    我有自己写的,也有SMARTUPLOAD,你要得话。来邮件
    [email protected]
      

  4.   

    上传的页面
    INDEX.HTML
    <HTML>
    <BODY BGCOLOR="white"><H1>jspSmartUpload : Sample 1</H1>
    <HR><FORM METHOD="POST" ACTION="/jspsmartupload/jsp/sample1.jsp" ENCTYPE="multipart/form-data">
       <INPUT TYPE="FILE" NAME="FILE1" SIZE="50"><BR>
       <INPUT TYPE="FILE" NAME="FILE2" SIZE="50"><BR>
       <INPUT TYPE="FILE" NAME="FILE3" SIZE="50"><BR>
       <INPUT TYPE="FILE" NAME="FILE4" SIZE="50"><BR>
       <INPUT TYPE="SUBMIT" VALUE="Upload">
    </FORM></BODY>
    </HTML>
    JSP程序
    sample1.jsp<%@ page language="java" import="com.jspsmart.upload.*"%>
    <jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" /><HTML>
    <BODY BGCOLOR="white">
    <H1>jspSmartUpload : Sample 1</H1>
    <HR><% // Variables
    int count=0;         // Initialization
    mySmartUpload.initialize(pageContext); mySmartUpload.setTotalMaxFileSize(100000); // Upload
    mySmartUpload.upload(); try { // Save the files with their original names in the virtual path "/upload"
    // if it doesn't exist try to save in the physical path "/upload"
    count = mySmartUpload.save("/upload");

    // Save the files with their original names in the virtual path "/upload"
    // count = mySmartUpload.save("/upload", mySmartUpload.SAVE_VIRTUAL); // Display the number of files uploaded 
    out.println(count + " file(s) uploaded."); } catch (Exception e) { 
    out.println(e.toString());
    }

    %></BODY>
    </HTML>
    其实,只要你下载SMARTUPLOAD,它有好多例子。
      

  5.   

    SMARTUPLOAD已经发给你了,用法很简单,它有好多EXAMPLE~~~
    当然,你也可以直接在
    http://www.jspsmart.com/liblocal/download/EN/jspSmartUpload.zip
    下载