% If Request("act")="upload" Then Server.ScriptTimeout=999999999 'SET THE PATH OF WHERE TO STORE THE FILES HERE Dim path,up_type up_type = Request("type") If up_type="ph" Then path = "/images/attorneys/" Elseif up_type="pdf" Then path = "/pdfs/" End If dim filename filename = Request("flname") dim upd_doc dim flnam,pth,NewFileName dim flObj,upl dim biData dim Message 'Now whatever the admin uploads, we have a preset file name for each of 'them. We now upload this to the specific directory. set upl = new BinForm upl.Read() upl.Extensions=Array(".htm") upl.Directory=server.mappath(path) upl.Create=false upl.OverWrite=true set flObj=server.createobject("Scripting.FileSystemObject") if len(upl.form("flname")) > 0 then if flObj.FileExists(server.mappath("path"&flnam)) then flObj.DeleteFile(server.mappath("path"&flnam)) end if upl.Save("flname") if upl.Success then Message = "
'" & flnam & "' was successfully uploaded!
" else Message = "There was an error uploading this file. Please try again.Possible causes are:
" Message = Message + "
" Message = Message + "Possible server causes:
" Message = Message + "
"
Message = Message + ""
end If
set upl=nothing
set flObj=nothing
else
Message= "
This file cannot be uploaded."
end If
Response.Redirect "/admin/file_manager.asp?t=" & up_type & "&msg=" & Server.URLEncode(Message)
Elseif Request("act")="delete" Then
up_type = Request("type")
If up_type="ph" Then
path = "/images/attorneys/"
Elseif up_type="pdf" Then
path = "/pdfs/"
End If
dim fs
Set fs=Server.CreateObject("Scripting.FileSystemObject")
dim FileArray,count
FileArray=Split(Request("flname"),",")
If UBound(FileArray)>0 Then
Message = "
"
For count=0 to UBound(FileArray)
if fs.FileExists(server.mappath(path & Trim(FileArray(count)))) then
fs.DeleteFile(server.mappath(path & Trim(FileArray(count))))
Message = Message + "'" & Trim(FileArray(count)) & "' has been deleted!
"
else
Message = Message + "'" & Trim(FileArray(count)) & "' could NOT be deleted!
"
end if
Next
Message = Message + "
'" & Request("flname") & "' has been deleted!
" else Message = "'" & Request("flname") & "' could NOT be deleted!
" end if End If set fs=nothing Response.Redirect "/admin/file_manager.asp?t=" & up_type & "&msg=" & Server.URLEncode(Message) End If %>