%@page contentType="text/html;charset=utf-8" import="java.io.*,java.sql.*,java.util.*,jerehnet.jsp.database.*,jerehnet.jsp.util.*,java.text.SimpleDateFormat,java.net.*"%>
<%
String path = request.getRealPath("/");
path=path.replace("jrcms_aote\\website\\zhuzhan\\","jrcms_aote\\resource\\");//linux系統下
String filename = Common.getFormatPara(request.getParameter("filename"));
if(filename==null) filename="";
filename=filename.replace("..","");
filename=filename.replace(" ","");
filename=filename.replace("https://resource.tjaote.cn/","");
String title = (request.getParameter("title"));
if(title==null) title="";
if(filename.length()>4){
if(filename.indexOf(".")!=-1){
title = title + filename.substring(filename.lastIndexOf(".")-1);
}else{
title = title + filename.substring(filename.length() - 4);
}
}
filename=filename.replace("/","\\");
filename=path+filename;
java.io.File ff=null;
try{
ff=new java.io.File(filename);
if(!ff.exists()){
out.print("error!");
return;
}
}
catch(Exception e){
out.print("error!!");
return;
}
try{
if (ff!=null&&ff.exists()&&ff.isFile())
{
long filelength = ff.length();
InputStream inStream=new FileInputStream(filename);
response.reset();
response.setContentType("charset=utf-8");
response.setContentType("application/x-msdownload");
response.setContentLength((int)filelength);
response.addHeader("Content-Disposition","attachment; filename=\"" +URLEncoder.encode(title, "UTF-8") + "\"");
byte[] b = new byte[100];
int len;
while((len=inStream.read(b)) >0)
response.getOutputStream().write(b,0,len);
inStream.close();
}
}
catch(Exception e){
out.print("error!!!!");
}
finally{
//====清除getOutputStream錯誤===
out.clear();
out = pageContext.pushBody();
}
%>黄色视频在线免费观看