Response.BinaryWrite Office 2007 docs corrupted
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
<% file_name = REQUEST("FILE_NAME") '다운받을 파일명 strFilePath ="D:\WebSite\DCS\" & file_name '경로 URL = strFilePath Dim fso, msg Set fso = CreateObject("Scripting.FileSystemObject") If (fso.FileExists(URL)) Then strName2= Mid(file_name,InstrRev(file_name, ".")+1) strName1 = UCase(trim(strName2)) if strName1 = "EXE" or strName1 ="exe" then URL = "../DCS/" & file_name Response.Redirect URL else if strName1 = "asp" or strName1 = "ASP" or strName1 = "INC" or strName1 ="inc" then response.redirect "../Error.asp?ERROR=500&EI=UPLOAD" else Select case strName1 case "DOC" Response.ContentType = "application/vnd.ms-word" case "DOCX" Response.ContentType = "application/vnd.ms-word" case "XLSX" Response.ContentType = "application/vnd.ms-excel" case "XLS" Response.ContentType = "application/vnd.ms-excel" Case Else Response.ContentType = "application/unknown" end Select Response.AddHeader "Content-Disposition","attachment; filename=" &file_name Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open objStream.Type = 1 objStream.LoadFromFile URL download = objStream.Read Set objstream = nothing Response.BinaryWrite download end if end if else response.write "파일이 존재 하지 않습니다." end if %> |
참조 : http://www.aspsnippets.com/Articles/Save-Files-to-SQL-Server-Database-using-FileUpload-Control.aspx
다운로드시 10M 이상 다운로드 안될때 // IIS 서비스 재시작
C:\WINDOWS\system32\inetsrv
MetaBase.xml 열어 수정 (범퍼/업로드)
AspBufferingLimit=”10240000″ => AspBufferingLimit=”20240000″
AspMaxRequestEntityAllowed=”4240000″ => spMaxRequestEntityAllowed=”20240000″