<% 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"), "'", "''") & "'", con, 1, 3 if rsLibrary.RecordCount > 0 then %> <% rsLibrary.close set rsLibrary = nothing con.close set con = nothing Set objFileSystem = Nothing Response.End() end if objFileSystem.CopyFile Server.MapPath("temp") & "\" & Request("FileName"), server.mappath("../../Uploads") & "\", True DeleteFile Server.MapPath("temp") & "\" & Request("FileName") rsLibrary.AddNew() rsLibrary("CategoryID") = Request("CategoryID") rsLibrary("Description") = Request("Description") rsLibrary("FileName") = Request("FileName") rsLibrary("FileType") = LCase(Right(Request("FileName"), 4)) rsLibrary("UploadDate") = Now() rsLibrary.Update() rsLibrary.close set rsLibrary = nothing con.close set con = nothing Set objFileSystem = Nothing response.redirect "default.asp?CategoryID=" & Request("CategoryID") & "&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

File / Document Library - Add a File / Document

<% if rsCategory.EOF then %>

There are no categories! Categories must exist first.

<% else %>

Category:

Description:

File / Document:

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