<!--#include file="../admin_conn.asp" -->
<%
dim sfile: sfile = be("get","file")
if isN(sfile) then errmsg "文件不能为空"
call downFile(sfile)
dispseObj()

sub downFile(fileName)
	dim filePath,fsize,s
	filePath = "../../upload/export/"&fileName&".txt"
	Response.Buffer = True
	Response.Clear
	Set s = Server.CreateObject("ADODB.Stream")
	s.Open
	s.Type = 1
	on error resume next
	fsize = objFile.getFileSize(filePath)
	s.LoadFromFile( server.MapPath(filePath) )
	session.CodePage = 936	
	Response.ContentType = "APPLICATION/OCTET-STREAM;charset=utf-8"
	Response.AddHeader "Content-Disposition","attachment; filename="&fileName&".txt"
	session.CodePage = 65001
	Response.BinaryWrite s.Read
	Response.Flush
	s.Close 
	Set s = Nothing
	if err then errmsg "下载时发生错误" : err.clear
End sub
%>