<%
Response.clear
Response.Buffer = False
idx = QueryFilter(request("idx"))
Call null_chk(idx, "올바르지 않은 접근입니다.")
sql = "select top 1 * from board_file with(nolock) where idx='"&idx&"' "
rs.open sql,dbcon
If rs.eof Then
rs.close
dbcon.close
Call caution_go("자료가 존재하지 않습니다.",-1)
Else
org_name = rs("org_name")
file_name = rs("file_name")
rs.close
end if
'다운로드 횟수 추가
sql = "update board_file set download=download+1 where idx='"&idx&"' "
dbcon.Execute(sql)
dbcon.close
file_path = Request.ServerVariables("APPL_PHYSICAL_PATH") & "uploadfile\board\"
' file_path = Replace(file_path,"diops2019","diops2018") '임시
'Response.write filepath
'Response.end
StoreDIR = file_path
filepath = StoreDIR & file_name
' 크롬 브라우저만 AddHeader를 공격패턴으로 인식하여, 헤더중복 등의 이유로 안됨 -> 크롬만 헤더없이 다운로드로 변경(2019.08.16)
' 단, 엣지는 정상 동작은하나, 크롬으로 인식되어 크롬과 함께 해더없이 다운됨.
If InStr(Request.ServerVariables("HTTP_USER_AGENT"), "Chrome") > 0 Then
Else
Response.AddHeader "Content-Disposition","attachment;filename=" & server.URLPathEncode(org_name)
End If
set objFS =Server.CreateObject("Scripting.FileSystemObject")
set objF = objFS.GetFile(filepath)
Response.AddHeader "Content-Length", objF.Size
set objF = nothing
set objFS = nothing
Response.ContentType = "application/unknown"
Response.CacheControl = "public"
Set objDownload = Server.CreateObject("DEXT.FileDownload")
objDownload.Download filepath
Set objDownload = Nothing
Response.end
%>