<% Response.buffer = truerenponse.clear
DIM URL DIM FSO, FL, FLSIZE DIM DNAME DIM OBJSTREAM, ContentTy, Flname, Isre, URL1 '************************************************ *************** Download file name DNAME = Trim (Request ("N")) '************** *********************************************************** ** if DName <> "" THEN '******************************* Download the server directory URL = Server . Mappath ("/") & "/" & dname "********************************************** ************* * End if
Set fso = Server.CreateObject ( "Scripting.FileSystemObject") Set fl = fso.getfile (url) flsize = fl.size flName = fl.name Set fl = Nothing Set fso = Nothing%> <% Set objStream = Server.CreateObject ("AdoDb.Stream") objstream.open objstream.type = 1 objstream.loadfromfile URL
Select Case Lcase (Right (Flname, 4)) case ".asf" contenttype = "video / x-ms-asf" case ".avi" contenttype = "video / avi" case ".doc" contenttype = "Application / MSWORD "Case" .zip "contenttype =" Application / ZIP "case" .xls "contenttype =" Application / VND.ms-Excel "case" .gif "ContentType =" image / gif ".jpg", "jpeg" ContentType = "image / jpeg" case ".wav" contenttype = "AUDIO / WAV" case ".mp3" contentty = "AUDIO / MPEG3" CASE ". MPG", "MPEG" contenttype = "VIDEO / MPEG" case ". rtf "ContentType =" application / rtf "Case" .htm "," html "ContentType =" text / html "Case" .txt "ContentType =" text / plain "Case Else ContentType =" application / octet-stream "End SelectResponse .Addic-disposition "," attachment; filename = "& flname response.addheader" content-length ", FLSIZE
Response.charset = "UTF-8" response.contentType = ContentType
Response.binarywrite objstream.read response.flush response.clear () objstream.close set objstream = Nothing
%>