<%
response.setHeader("Pragma","No-cache"); 
response.setHeader("Cache-Control","no-cache"); 
response.setDateHeader("Expires", 0); 
%><%@ page contentType="text/html;charset=gb2312"%><%@ page import="com.jspsmart.upload.*,java.io.*,affix.*,affix.Exception.*"%><jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" /><%
  String ID=request.getParameter("ID");
   String Name=request.getParameter("Name");
   String directory=FileDirectory.getAttach()+ID+java.io.File.separator+Name;       String contentType = "x-application/msdownload";
      
   try{
  mySmartUpload.initialize(pageContext);  
  mySmartUpload.downloadFile(directory,contentType,new String(Name.getBytes("GB2312"),"8859_1"));
    
   }catch(Exception e){
       e.printStackTrace();
   }
%>

解决方案 »

  1.   

    <%@page language="java" pageEncoding="GB2312" import="com.jspsmart.upload.*"%><%
    SmartUpload download = new SmartUpload();
    try{
    download.initialize(pageContext);
    download.setContentDisposition(null);
    String filename=request.getParameter("filename");
    String path="/upload/"+filename;
    download.downloadFile("/down/form_txt12.gif");
    }catch(SmartUploadException e){e.printStackTrace();}%>你的fielname参数获得的冬冬不正确
      

  2.   

    /down为你的web夹下的一个文件夹,提供下载,form_txt12.gif为/down下的一个图片文件
      

  3.   

    最好用servlet,直接用jsp很容易出现你说的错误,参考一下smartupload提供的例子
      

  4.   

    import="com.jspsmart.upload.*" 这个包里面有什么内容??
    SmartUpload download = new SmartUpload();这个类,在哪里?
    我这里只有一个jspSmartUpload.jar文件。
      

  5.   

    在一个新的JSP页中,没有其它代码了
    <%
    com.jspsmart.upload.SmartUpload  mySmartUpload=new  com.jspsmart.upload.SmartUpload();
    mySmartUpload.initialize(pageContext);
    mySmartUpload.setContentDisposition("attachment;");
    String filename=request.getParameter("filename");
    String path=application.getRealPath("/")+"upload/"+filename;
    mySmartUpload.downloadFile(msgappfilepath);
    %>
      

  6.   

    是com.jspsmart.upload.SmartUpload 文件写的有问题,我在SmartUpload.java文件的downloadFile函数里加了m_response.getOutputStream().close();解决了问题
      

  7.   

    <%@page language="java" pageEncoding="GB2312" import="com.jspsmart.upload.*"%><%
    SmartUpload download = new SmartUpload();
    try{
    download.initialize(pageContext);
    download.setContentDisposition(null);
    String filename=request.getParameter("filename");
    String path="/upload/"+filename;
    download.downloadFile("/down/form_txt12.gif");
    }catch(SmartUploadException e){e.printStackTrace();}%>
    我也在这个问题上搞了好久,为了让更多的人不吃这个苦,吗的要这么写!!!!在你得download.jsp中这么写!
      

  8.   

    那这个JSP文件中要是还有其他的控件和处理过程不是很麻烦,不能出现HTML标记。