jspsmart的下载问题 mySmartUpload.downloadFile("../loadfiles/upload/h.class");要绝对路径的吧~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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); }%> <%//处理附件 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();%>这是我写的 <meta http-equiv="Content-Type" content="application/msword;charset=gb2312">改为response.setContentType("application/msword;charset=gb2312"); 不知大家有没有jspsmartupload,从oracle数据库中进行文件下载的例子,能给我发一份[email protected] internal error flushing the buffer in release()错误帮忙看下? 不圾远程访问tomcat5.0.28 单jsp开发还有前途吗? 初学者请教问题之七:jsp分页取值问题 谁能帮我看看脚本算日期的问题 鼠标移到标题上显示图片什么实现 求助:在JBuilder中由于导于类无法正确编译! 比較兩種不同設計方式的session各佔用內存的大小 请问如何在jsp中调用weblogic中的连接池 有谁做过数据库读取时等待的进度条!急!原理是什么?达人请进! 哪里下载Tomcat 5 jspsmartupload的下载问题。。
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);
}
%>
//处理附件
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();%>这是我写的
改为
response.setContentType("application/msword;charset=gb2312");