Response can put the file to the user can not reach the place, and then in the ASP file with BinaryRead, the method sent to the user, here is a function,
Const forreading=1
Const Tristatetrue=-1
Const file_transfer_size=16384
Function transferfile (path, mimetype)
Dim Objfilesystem, objfile, objstream
Dim Char
Dim sent
Send=0
Transferfile = True
Set Objfilesystem=server. CreateObject ("Scripting.FileSystemObject")
Set objfile = objfilesystem.getfile (path)
Set objstream = Objfile.openastextstream (ForReading, TristateTrue)
Response.AddHeader "Content-type", mimetype
Response.AddHeader "Content-disposition", "Attachment;filename=" &file_name
Response.AddHeader "Content-length", objfile.size
Do as not Objstream.atendofstream
char = Objstream.read (1)
Response.BinaryWrite (char)
Sent = sent + 1
If (Sent MOD file_transfer_size) = 0 Then
Response.Flush
If not response.isclientconnected Then
Transferfile = False
Exit do
End If
End If
Loop
Response.Flush
If not response.isclientconnected Then transferfile = False
objStream.Close
Set objstream = Nothing
Set Objfilesystem = Nothing
End Function
Dim MimeType, sucess
MimeType = "Application/x-msdownload"
File_path=server. MapPath ("software/" & file_name)
Success = Transferfile (File_path, MimeType)
%>