%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>
<% If Session("ValidatedStudent") <> True Then
Response.Redirect "error.asp?error=denied"
End If %>
Successful File Upload
<%
Dim strAbsPath 'Absolute Path of active directory -- strRoot & \ etc.
Dim objFSO 'FileSystemObject
Dim objFolder 'FolderObject
Dim objFile 'FileObject
'The absolute Path of the destination directory.
strAbsPath = Session("upabspath") & "\"
'Create the File System Object
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'Create the Folder object (to easily access the folder's files and folders)
Set objFolder = objFSO.GetFolder("c:\vbstudents")
'Copy files found in c:\vbstudents to the user's folder
If objFolder.Files.Count > 0 Then
'Delete any executable files that were uploaded
For Each objFile In objFolder.Files
If InStr(objFile.Name, ".ex_") <> 0 Or _
InStr(objFile.Name, ".ba_") <> 0 Or _
InStr(objFile.Name, ".vb_") <> 0 Or _
InStr(objFile.Name, ".cm_") <> 0 Or _
InStr(objFile.Name, ".co_") <> 0 Then
objFSO.DeleteFile("c:\vbstudents\" & objFile.Name)
End If
Next 'objFile
'Copy the remaining files to the Student's folder
If objFolder.Files.Count > 0 Then
objFSO.CopyFile "c:\vbstudents\*.*", strAbsPath
objFSO.DeleteFile ("c:\vbstudents\*.*")
End If
End If
Set objFolder = Nothing
Set objFSO = Nothing
Response.Redirect ("user.asp?email=" & Session("upemail") & "&action=list&path=" & Crypt(Session("uprelpath")))
%>