프로그래밍/ASP

asp File Download/파일다운로드

p-a-r-k 2015. 4. 3. 16:12
반응형

asp 파일 다운로드 소스


<%@ Language=VBScript CodePage = "65001" %>
<%  Response.Charset = "UTF-8" %>
<%
   sFileName = "test.zip"'or request
   sFilePath = "download"'or request

   filepath= "D:\Web\test.event-page.co.kr\"& sFilePath &"\"& sFileName

   Response.ContentType = "application/unknown"
   Response.AddHeader "Content-Disposition","attachment; filename=" & Server.URLPathEncode(sFileName)

	Set objStream = Server.CreateObject("ADODB.Stream")
	objStream.Open
	objStream.Type = 1
	objStream.LoadFromFile filepath
	download = objStream.Read
	Response.BinaryWrite download 
	Set objstream = nothing 
%>

반응형