<%
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();
}
%>
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();
}
%>
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参数获得的冬冬不正确
SmartUpload download = new SmartUpload();这个类,在哪里?
我这里只有一个jspSmartUpload.jar文件。
<%
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);
%>
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中这么写!