日期:2014-05-18  浏览次数:20674 次

急急!!!请教 用JspSmartUpload上传出现了问题~~~在线等
最近做在线书店的项目   添加书时   要上传图片  
我用SmartUpload上传图片   老师出问题   图片能上传   就是上传的都是重复的   只能上传第一次传的   有时还报java.lang.StringIndexOutOfBoundsException:   String   index   out   of   range:   -190   错误  
Servlet的代码如下:
package   bookshop;

import   javax.servlet.*;
import   javax.servlet.http.*;
import   java.io.*;
import   java.util.*;
import   com.jspsmart.upload.*;
import   Entity.*;
import   business.*;
public   class   addBookServlet   extends   HttpServlet   {
        private   static   final   String   CONTENT_TYPE   =   "text/html;   charset=GBK ";


        private   ServletConfig   sc;
      private     SmartUpload   su;
      private   com.jspsmart.upload.Request   req;
        public   void   init()   throws   ServletException   {
                  sc=this.getServletConfig();
                  su=new   SmartUpload();


        }

   
        public   void   doGet(HttpServletRequest   request,   HttpServletResponse   response)   throws
                        ServletException,   IOException   {
                    doPost(request,   response);
           

        }

        public   void   doPost(HttpServletRequest   request,   HttpServletResponse   response)   throws
                        ServletException,   IOException   {


              su.initialize(sc,request,response);
              su.setTotalMaxFileSize(10000);
              su.setAllowedFilesList( "jpg,gif ");
                req=su.getRequest();
     

      try   {

              su.upload();
              String   path=request.getRealPath( "/ ");
              su.save(path+ "/upload ");
      }   catch   (SmartUploadException   ex)   {
      }   catch   (IOException   ex)   {
      }   catch   (ServletException   ex)   {
      }

          String   name=req.getParameter( "name ");
          String   description=re