顶一下了,看来高人都在想着怎么过年了

解决方案 »

  1.   

    问题我也没见过,只能帮你顶喽。
    思考!
      

  2.   

    拖了两天还不如自己看源码自己搞定.
      

  3.   

    这个模块没有源码吧,谁有,给一个
      

  4.   

    送上针对smartupload写的工具类,供你参考。package new.com.website.util;
    import com.jspsmart.upload.*;
    import javax.servlet.http.*;
    import javax.servlet.jsp.*;
    import new.com.website.vo.voConfig;
    import new.com.website.bean.systemmanage.configManage.web_Config;//上传文件。
    public class UploadUtil {  private long maxSize;//最大字节数(B)
      private String path;//存储路径(绝对路径,包括主文件名,不包括括展名)
      private String format;//文件格式
      private PageContext pageContext;
      private com.jspsmart.upload.SmartUpload smartUpload;
      private String primaryFileName;//主文件名
      private String fileName;
      private String relativePath;//相对路径
      private String pathAndFileName;  public UploadUtil()
      {
        this.smartUpload=new com.jspsmart.upload.SmartUpload();
      }
      public UploadUtil(PageContext pageContext)
      {
        this.smartUpload=new com.jspsmart.upload.SmartUpload();
        this.pageContext=pageContext;
      }
      public UploadUtil(long maxSize,String path,String format,PageContext pageContext)
      {
        this.maxSize=maxSize;
        this.path=path;
        this.format=format;
        this.pageContext=pageContext;
        this.smartUpload=new com.jspsmart.upload.SmartUpload();
      }  public void setPrimaryFileName(String str)
      {  this.primaryFileName=str;}
      public String getPrimaryFileName()
      {  return this.primaryFileName;}
      public void setMaxSize(long n)
      {  this.maxSize=n*1024;}
      public long getMaxSize()
      {  return this.maxSize;}
      public void setPath(String str)
      {  this.path=str;}
      public String getPath()
      {  return this.path;}
      public void setFormat(String str)
      {  this.format=str;}
      public String getFormat()
      {  return this.format;}
      public void setPageContext(PageContext obj)
      {  this.pageContext=obj;}
      public String getFileName()
      {  return this.fileName;}
      public void setRelativePath(String str)
      {  this.relativePath=str;}
      public String getRelativePath()
      {  return this.relativePath;}
      public Request getRequest()
      {  return this.smartUpload.getRequest();}
      public String getAbsolutePathAndFileName()
      {
        return this.pathAndFileName;
      }
      public String getRelativePathAndFileName()
      {
        return this.relativePath.trim()+this.fileName;
      }  public boolean upload()
      {
        boolean result=false;
        try
        {
          smartUpload.initialize(pageContext);
          smartUpload.setMaxFileSize(this.maxSize);
          smartUpload.setAllowedFilesList(this.format);
          smartUpload.upload();      com.jspsmart.upload.File file=smartUpload.getFiles().getFile(0);
          if(file.getSize()>this.maxSize)
            throw new Exception("文件太大。");
          if(file.getSize()==0&&file.getFileExt().equals(""))
          {
            throw new Exception("上传失败!");
          }
          file.saveAs(this.path+"."+file.getFileExt().toLowerCase());
          this.fileName=new java.io.File(this.path+"."+file.getFileExt().toLowerCase()).getName();
          this.pathAndFileName=new java.io.File(this.path+"."+file.getFileExt().toLowerCase()).getPath();
          result=true;
        }
        catch(Exception e)
        {
          result=false;
          e.printStackTrace();
        }
        return result;
      }public boolean defaultUpload(String str)
      {
        if(str.charAt(str.length()-1)!='\\'||str.charAt(str.length()-1)!='/')
          str=str+"\\";
        voConfig conf=new web_Config().voGet_Config_Info();
        this.relativePath=conf.getUpload_file_path().trim();
        this.maxSize = conf.getUpload_file_size()*1024;
        this.primaryFileName=String.valueOf(new java.util.Date().getTime());
        this.path =str+DoFile.doString(this.relativePath)+this.primaryFileName;
        this.format = conf.getUpload_file_type().trim()+",";
        return this.upload();
      }
    }