<% Dim db, rst, DSNtemp, Upload, File Dim userid, username, validuser, errorStr Dim filenames, name, descript, i, authenticated authenticated = Session("PrivateAreaAuthenticated") If authenticated <> True Then Response.Redirect("http://www.goaction.com") ElseIf Session("PrivateAreaAdmin") <> True Then Response.Redirect(Session("PrivateAreaUserpage")) End if errorStr = "Invaild user. Aborting update." validuser = False Set db = Server.CreateObject("ADODB.Connection") Set rst = Server.CreateObject("ADODB.Recordset") DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/data/private.mdb") db.Open DSNtemp Set Upload = Server.CreateObject("Persits.Upload.1") Upload.Save(Server.MapPath("/private/temp")) If Not IsNull(Upload.Form("uid")) Or Upload.Form("uid") <> "" Then userid = Upload.Form("uid") Set rst = db.Execute("SELECT UserID,UserName FROM tblUser WHERE UserID=" & userid) If Not rst.EOF Then username = rst("UserName") If username <> "" Or Not IsNull(rst("UserName")) Then validuser = True End If End If End If %> Action Systems: Private Download Area: Admin Page: Update Page Info
Private Download Area
Admin Page
Update Page Info
<% If validUser = True Then filenames = "" For Each File In Upload.Files If Not File Is Nothing Then File.Copy Server.MapPath("/private/" & username & "/" & File.FileName),True File.Delete name = File.FileName descript = Upload.Form(File.Name & "descript") db.Execute("INSERT INTO tblFiles (FileName,FileDescription) VALUES ('" & name & "','" & descript & "')") Set rst = db.Execute("SELECT * FROM tblFiles ORDER BY FileID DESC") If Not rst.EOF Then If InStr(rst("FileName"),name) <> 0 Then db.Execute("INSERT INTO tblUserFiles (UserID,FileID) VALUES (" & userid & "," & rst("FileID") & ")") filenames = filenames & File.FileName & "|" End If End If rst.Close Set rst = Nothing End If Next Response.Write "The following file(s) were successfully uploaded to the server for the user " & username & ":
" filenames = split(filenames,"|",-1,1) For i = 0 to UBound(filenames) Response.Write filenames(i) & "
" Next Else Response.Write errorStr End If db.Close Set db = Nothing Set Upload = Nothing %>

Close this window