Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.
Sub DownloadFile(sFile) strAbsFile = Server.MapPath("\TimeMag") & "\" & sFile Set objFSO = Server.CreateObject("Scripting.FileSystemObject") If objFSO.FileExists(strAbsFile) Then Set objFile = objFSO.GetFile(strAbsFile) ContentType = "application/x-msdownload" Response.Buffer = True Const adTypeBinary = 1 Response.Clear Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open objStream.Type = adTypeBinary objStream.LoadFromFile objFile.Path ContentType = "application/octet-stream" Response.AddHeader "Content-Disposition", "attachment; filename=""" & objFile.Name & """" Response.Charset = "UTF-8" Response.ContentType = ContentType Response.BinaryWrite objStream.Read Response.Flush objStream.Close Set objStream = Nothing End If End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.