home *** CD-ROM | disk | FTP | other *** search
/ 207.233.110.77 / 207.233.110.77.tar / 207.233.110.77 / vbasic / ProcessUpload.asp < prev    next >
Text File  |  2003-09-18  |  2KB  |  51 lines

  1. <%@ LANGUAGE="VBSCRIPT" %>
  2. <% Option Explicit %>
  3. <!-- METADATA 
  4.    TYPE="TypeLib" 
  5.    FILE="C:\Program Files\Common Files\System\ADO\msado21.tlb" 
  6. -->
  7. <!--#include file="Crypt-DeCrypt.asp"-->
  8. <% If Session("ValidatedStudent") <> True Then
  9.     Response.Redirect "error.asp?error=denied"
  10. End If %>
  11. <html>
  12. <head>
  13. <title>Successful File Upload</title>
  14. </head>
  15. <body>
  16. <%
  17.     Dim strAbsPath    'Absolute Path of active directory -- strRoot & <folder>\<folder> etc.
  18.     Dim objFSO            'FileSystemObject 
  19.     Dim objFolder        'FolderObject 
  20.     Dim objFile            'FileObject 
  21.  
  22.     'The absolute Path of the destination directory. 
  23.     strAbsPath = Session("upabspath") & "\"
  24.     'Create the File System Object
  25.     Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
  26.     'Create the Folder object (to easily access the folder's files and folders)
  27.     Set objFolder = objFSO.GetFolder("c:\vbstudents")
  28.     'Copy files found in c:\vbstudents to the user's folder
  29.     If objFolder.Files.Count > 0 Then
  30.       'Delete any executable files that were uploaded
  31.     For Each objFile In objFolder.Files
  32.         If InStr(objFile.Name, ".ex_") <> 0 Or _
  33.            InStr(objFile.Name, ".ba_") <> 0 Or _
  34.            InStr(objFile.Name, ".vb_") <> 0 Or _
  35.            InStr(objFile.Name, ".cm_") <> 0 Or _
  36.            InStr(objFile.Name, ".co_") <> 0 Then
  37.           objFSO.DeleteFile("c:\vbstudents\" & objFile.Name)
  38.         End If
  39.       Next 'objFile
  40.       'Copy the remaining files to the Student's folder
  41.       If objFolder.Files.Count > 0 Then
  42.         objFSO.CopyFile "c:\vbstudents\*.*", strAbsPath
  43.         objFSO.DeleteFile ("c:\vbstudents\*.*")
  44.       End If
  45.     End If
  46.     Set objFolder = Nothing
  47.     Set objFSO = Nothing
  48.     Response.Redirect ("user.asp?email=" & Session("upemail") & "&action=list&path=" & Crypt(Session("uprelpath")))
  49. %>
  50. </body>
  51. </html>