mySmartUpload.downloadFile("../loadfiles/upload/h.class");
要绝对路径的吧~

解决方案 »

  1.   

    String path=null;
    String type=request.getParameter("type");
    String filename=request.getParameter("filename");
    String downloadname=request.getParameter("downloadname")+filename.substring(filename.lastIndexOf("."));
    if(type.equals("a")){
    path=BeansConstants.aPath;
    }else if(type.equals("b")){
    path=BeansConstants.bPath;
    }
    if(path!=null){
    mySmartUpload.initialize(pageContext);
    mySmartUpload.downloadFile(path+filename,"APPLICATION/OCTET-STREAM",downloadname);
    }
    %>
      

  2.   

    <%
    //处理附件
    String accessories=request.getParameter("accessories");
    byte[] tmpbyte=accessories.getBytes("ISO8859-1") ;
    accessories= new String(tmpbyte); String fileName = accessories.substring( accessories.lastIndexOf("/") + 1, accessories.length()).toString();
    //读到流中
    InputStream inStream=new FileInputStream("C:/Program Files/Apache Group/Tomcat 5.0/webapps/ROOT/" + accessories );;
    //设置输出的格式
    response.reset();
    response.setContentType("bin;text/html; charset=gb2312");// response.setContentType("APPLICATION/OCTET-STREAM");
      response.setHeader("Connection",  "close");
    response.setHeader("Content-Type",  "application/octet-stream");// response.setHeader("Content-Disposition",  "attachment;filename="+ Utilities.URLEncode(fileName));
    response.addHeader("Content-Disposition","attachment; filename=\"" + fileName + "\""); //循环取出流中的数据
    byte[] b = new byte[100];
    int len;
    while((len=inStream.read(b)) >0)
    response.getOutputStream().write(b,0,len);
    inStream.close();%>这是我写的
      

  3.   

    <meta http-equiv="Content-Type" content="application/msword;charset=gb2312">
    改为
    response.setContentType("application/msword;charset=gb2312");
      

  4.   

    不知大家有没有jspsmartupload,从oracle数据库中进行文件下载的例子,能给我发一份[email protected]