<%
Dim theForm,StoredPath,SVName
Dim FilePath
Dim SaveName,FileName
Dim ii,Rv,exts
Dim CNT,RES
Dim VC_ID,ARR,PAGE,mkPage
Dim RES_STR
	StoredPath = "./Files"
	RES_STR = ""

		SVName = Request.ServerVariables("SERVER_NAME")
		
		Set theForm= Server.CreateObject("DEXT.FileUpload")
		theForm.DefaultPath = Server.MapPath(StoredPath)
		RES = theForm.Form("VAR")
		VC_ID = theForm.Form("VC_ID")
		PAGE =  theForm.Form("PAGENAME")		

		If InStr(RES,",")>0 Then
			ARR = Split(RES,",")
			For Cnt=LBound(ARR) To UBound(Arr)
				mkPage = PAGE & "_" & Cnt+1 & "_FILE"
				If theForm.Form(mkPage)<>"" And VarType(theForm.Form(mkPage))<>0 And VarType(theForm.Form(mkPage))<>1 Then
				  FileName = theForm.Form(mkPage).FileName
				  exts = Right(FileName,3)
				  
					VC_ID = theForm.Form("IDKey")
					FilePath = theForm.Form(mkPage).SaveAs(theForm.DefaultPath & "\" & Arr(Cnt) & "_" &VC_ID&"_"&"."&exts,False)
					SaveName = Mid(FilePath, InstrRev(FilePath,"\") + 1)
					Rv = FilePath & "∏" & SaveName & "∑"
					RES_STR = RES_STR & SaveName & "@@"
				End If
			Next

		Else
			mkPage = PAGE & "_FILE"

			If theForm.Form(mkPage)<>"" And VarType(theForm.Form(mkPage))<>0 And VarType(theForm.Form(mkPage))<>1 Then
				FileName = theForm.Form(mkPage).FileName
				exts = Right(FileName,3)
				  
				VC_ID = theForm.Form("IDKey")
				FilePath = theForm.Form(mkPage).SaveAs(theForm.DefaultPath & "\"& PAGE & "_" &VC_ID &"."&exts,False)
				SaveName = Mid(FilePath, InstrRev(FilePath,"\") + 1)
				Rv = FilePath & "∏" & SaveName & "∑"
				RES_STR = RES_STR & SaveName & "@@"
			End If
		End If

		Set theForm = Nothing 

		If RES_STR<>"" Then
			'Response.Write SaveName
			Response.write Left(RES_STR,Len(RES_STR)-2)
		Else
			Response.Write LBound(ARR)
		End IF

%>
