본문으로 바로가기

강제로 다운로드 창 뜨게 하려면 사용하세요.

Response.Expires = 0
Response.Buffer =  True
Response.Clear

On Error Resume Next

filename = Request("filename")
filepath = Server.MapPath(".") & "\Upload\" & filename


Response.ContentType =  "application/unknown"
Response.CacheControl = "public"
Response.AddHeader "Content-Disposition", "attachment;filename=" & filename


'스트림 이용
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile filepath
strFile = objStream.Read
Response.BinaryWrite strFile
Response.Flush
Set objStream = Nothing


'SiteGalaxy이용
set fso = server.CreateObject("SiteGalaxyUpload.FileSystemObject")
  set file = fso.OpenBinaryFile (filepath,1,false)
  Response.BinaryWrite file.ReadAll  
set fso=nothing


'DextDownLoad 이용
Set objDownload = Server.CreateObject("DEXT.FileDownload")
objDownload.Download filepath
Set objDownload = Nothing


If Err Then
 Response.Write Err.number & "<br>" & Err.source & "<br>" & Err.description & "<br>"
 Err.Clear
End If