Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

download file from server

Status
Not open for further replies.

cumap

IS-IT--Management
Jul 9, 2007
268
0
0
US
hi all,

I'm having this added code to have a little more controlled files download environment; however, error "File Not Found" window displayed when I try to download ZIP files while PDF files are a OK.

Here's the code
Code:
Response.Buffer = True
Response.Clear
		
''set the directory that contains the files here
strFileName = Request.serverVariables("APPL_PHYSICAL_PATH") & "" & Request.QueryString("fname")

'response.contentType = "application/octet-stream"
response.addheader "content-disposition", "attachment; filename=" & request.QueryString("fname")
		set stream = server.CreateObject("ADODB.Stream")
stream.type = adTypeBinary
stream.open
stream.LoadFromFile strFileName
while not stream.EOS
response.BinaryWrite Stream.Read(1024 * 64)
wend
stream.Close
Set stream = Nothing
response.Flush
response.End

So, how can I fix this to download files as many file type as I can.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top