<%
response.reset();
OutputStream o=response.getOutputStream();
BufferedOutputStream bos=new BufferedOutputStream(o);
byte b[]=new byte[500];
File fileLoad=new File("D:/文档/电影/","王牌逗王牌.mkv");
response.setHeader("Content-disposition", "attachment;filename="+"王牌逗王牌.mkv");
response.setContentType("application/x-tar");
long fileLength=fileLoad.length();
String length=String.valueOf(fileLength);
response.setHeader("Content_Length", length);
FileInputStream in=new FileInputStream(fileLoad);
int n=0;
while((n=in.read(b))!=-1){
bos.write(b, 0, n);
}
bos.close();
response.reset();
%>
网友评论