<% Timeout(1) Set con = Server.CreateObject("ADODB.Connection") con.Open Application("CString") Set objFileSystem = Server.CreateObject("Scripting.FileSystemObject") if UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" then set rsLibrary = server.createobject("ADODB.Recordset") rsLibrary.open "SELECT * FROM Library WHERE FileName = '" & Replace(Request("FileName"), "'", "''") & "' OR Lib_FileID = " & Request("id"), con, 1, 3 if rsLibrary.RecordCount > 1 then %> <% rsLibrary.close set rsLibrary = nothing con.close set con = nothing Set objFileSystem = Nothing Response.End() end if if rsLibrary.EOF then %> <% rsLibrary.close set rsLibrary = nothing con.close set con = nothing Set objFileSystem = Nothing Response.End() end if rsLibrary.MoveFirst() if CLng(rsLibrary("Lib_FileID")) <> CLng(Request("id")) then %> <% rsLibrary.close set rsLibrary = nothing con.close set con = nothing Set objFileSystem = Nothing Response.End() end if if Request("FileName") <> "" then objFileSystem.CopyFile Server.MapPath("temp") & "\" & Request("FileName"), server.mappath("../../Uploads") & "\", True DeleteFile Server.MapPath("temp") & "\" & Request("FileName") if LCase(Request("CurrentFile")) <> LCase(Request("FileName")) then DeleteFile server.mappath("../../Uploads") & "\" & Request("CurrentFile") end if end if rsLibrary("CategoryID") = Request("CategoryID") rsLibrary("Description") = Request("Description") if Request("FileName") <> "" then rsLibrary("FileName") = Request("FileName") end if rsLibrary("FileType") = LCase(Right(Request("FileName"), 4)) if Request("FileName") <> "" then rsLibrary("UploadDate") = Now() end if rsLibrary.Update() rsLibrary.close set rsLibrary = nothing con.close set con = nothing Set objFileSystem = Nothing response.redirect "default.asp?intPage=" & Request("intPage") & "&buster=" & server.URLEncode(now) end if strSQL = "SELECT CategoryID, [Name] AS 'Category' " & _ "FROM Library_Category " & _ "ORDER BY [Name]" Set rsCategory = con.execute(strSQL) %> Website Administration <% if Request("id") <> Empty and IsNumeric(Request("id")) then strSQL = "SELECT CategoryID, Description, FileName FROM Library WHERE Lib_FileID = " & Request("id") Set rsFile = con.execute(strSQL) if not rsFile.EOF then rsFile.MoveFirst i_CategoryID = CLng(rsFile("CategoryID")) s_Description = rsFile("Description") s_FileName = rsFile("FileName") %>

File / Document Library - Edit a File / Document

<% if rsCategory.EOF then %>

There are no categories! Categories must exist first.

<% else %>

Category:

Description:

Current File / Document:

<%=Server.HTMLEncode(s_FileName)%>

Change File / Document:

"> ">

<% end if %>
<% end if Set rsFile = Nothing end if %> <% Set rsCategory = Nothing Set objFileSystem = Nothing con.Close set con = Nothing %>