% ' Copyright © 2004 Jim Buyens ' All rights reserved. Publication and/or resale prohibited. ' ' You may only use this Web page and associated documentation ' if you download it directly from http://www.interlacken.com. ' If you meet that condition, you may incorporate the page into ' Web sites you create for yourself or others, but you may not ' redistribute, publish, promote, or sell the page or ' documentation as a separate product or feature. ' ' Contact Jim Buyens, buyensj@interlacken.com, for additional ' terms and conditions. option explicit Response.Buffer = true Const strDnldUrl = "BMFA SAFETY.DOC" ' Code your path/filename here. Const adTypeBinary = 1 Dim strDnldFile Dim finDnldFile Dim fstDnldFile Dim fso strDnldFile = Server.MapPath(strDnldUrl) Set fso = Server.CreateObject("Scripting.FileSystemObject") If fso.FileExists(strDnldFile) Then Set finDnldFile = fso.GetFile(strDnldFile) Set fstDnldFile = Server.CreateObject("ADODB.Stream") Response.Clear() Response.ContentType = "application/octet-stream" Response.AddHeader "Content-Length", finDnldFile.Size Response.AddHeader "Content-Disposition", _ "attachment; filename=""" & finDnldFile.Name & """" fstDnldFile.Open fstDnldFile.Type = adTypeBinary fstDnldFile.LoadFromFile strDnldFile Response.BinaryWrite fstDnldFile.Read fstDnldFile.Close Set fstDnldFile = Nothing Set finDnldFile = Nothing Set fso = Nothing Response.End End If Set fso = Nothing %>
File <%=strDnldUrl%> not found.