<!--#include file="function.asp"-->
<% 
   '  Variables
   '  *********
   Dim mySmartUpload
   Dim intCount
   Dim f, fc
   dim serverPath
   if Request.ServerVariables("SERVER_NAME") <> "sql-server" then
       serverPath = "c:\inetpub\wwwroot\contacts\"
   else
      serverPath = "c:\inetpub\wwwroot\bmsa\contacts\"  
   end if

   '  Object creation
   '  ***************
   
   UID = getUserID(request.cookies("ckyUserID"))
   set fso = Server.CreateObject("Scripting.FileSystemObject")
    'response.write(fso.FolderExists("c:\inetpub\wwwroot\contacts\tmp_upload") )
   'If fso Is Nothing then 
   ''   response.write("dead")
   'End If
   Set f = fso.GetFolder(serverPath & "tmp_upload")
   Set fc = f.Files
   For Each FullFile in fc
      Set AFile = fso.getFile(FullFile)
      if left(AFile.Name, len(UID) + 1) = UID & "_" then            
         s = s & "<option value=""" & AFile.Name & """>" & left(mid(AFile.Name, len(UID) + 2, len(AFile.Name)), 20) 
         ls = ls & mid(AFile.Name, len(UID) + 2, len(AFile.Name)) & ";"
      end if
   Next
   'For Each f1 in fc
   '   if left(f1.name, len(UID) + 1) = UID & "_" then            
   '      s = s & "<option value=""" & f1.name & """>" & left(mid(f1.name, len(UID) + 2, len(f1.name)), 20) 
   '      ls = ls & mid(f1.name, len(UID) + 2, len(f1.name)) & ";"
   '   end if
   ' Next
   ' set f1 = nothing

   set FullFile = nothing
   set fc = nothing
   set fso = nothing
%>
<HTML> 
<head>
<title>Add/Remove Email Attachments</title>
</head>
<script>window.opener.document.form.attach.value="<%= ls %>";</script>
<body class='bod_lite'> 
<FORM METHOD="POST" enctype="multipart/form-data"  ACTION="fAttach.cls.asp">
<INPUT TYPE=FILE NAME="FILE1">&nbsp;&nbsp;<INPUT TYPE="SUBMIT" name='btnSubmit' VALUE="Add"><BR> 
<select NAME="fselect"><%= s %></select>&nbsp;&nbsp;<INPUT TYPE="SUBMIT" name='btnDelete' VALUE="Remove"> 
</FORM> 
</BODY> 
</HTML> 