non mi funziona bene il redirect! Response.redirect("loading.asp") devo inserirlo nella pagina upload.asp? dopo quale codice?non funziona a dovere..cioè non parte subito il redirect alla pagina loading.asp mentre sta caricando il file.Il redirect entra in azione appena il file è stato trasferito completamente!


upload.asp:

codice:
<%
Response.Expires = 0
Response.Buffer = TRUE
'Response.Clear
%>

<%
'Creiamo l'oggetto FileUploader ed assegnamogli il nome Uploader
Dim Uploader, File
Set Uploader = New FileUploader

'Impostiamo la dimensione max del file in byte
Uploader.maxSize = 50000000 '50kb

'Impostiamo il tipo di file ammessi
Uploader.fileExt = "jpg, gif, btm, zip, rar, doc, bmp, pdf, jpeg, png, tif, txt, mdb, rtf"

'Iniziamo il processo di upload
Uploader.Upload()


'Visualizziamo i file caricati
%>
<html>
<head>
<title>Upload immagini</title>
<link rel="stylesheet" href="../include/ecommerce.css">
</head>
<body bgcolor="#EFEFEF">
<center>
<form action="inviafile.asp">
<table border="0" width="500" bgcolor="#000080" cellspacing="1" cellpadding="0">
  <tr>
    <td width="100%">
      <table border="0" width="100%" bgcolor="#FFFFEC" cellspacing="0" cellpadding="0" height="234">
        <tr>
          <td width="100%" height="37">
            <p align="center">File caricato.</p>
          </td>
        </tr>
<%
strPath = Server.MapPath("/public") & "/"

'Controlliamo se sono stati inviati dei file
If Uploader.Files.Count = 0 Then
%>
        <tr>
          <td width="100%" height="18"><font color="#000080" size="2" face="Tahoma">Nome file:Nessun file inviato.</font></td>
        </tr>
<%
	If Uploader.Error Then
%>	
        <tr>
          <td width="100%" height="18"><font color="#000080" size="2" face="Tahoma">Errore:<%=Uploader.ErrorDesc%></font></td>
        </tr>	
<%	
  End If
Else

	'Ciclo tra i file inviati
	For Each File In Uploader.Files.Items
		
		'Salvo il file
		File.SaveToDisk strPath

		'Mostriamo i dettagli dei file salvati
%>
        <tr>
          <td width="100%" height="18"><font color="#000080" size="2" face="Tahoma">Nome file:<%=File.FileName%></font></td>
        </tr>
        <tr>
          <td width="100%" height="18"><font color="#000080" size="2" face="Tahoma">Dimensioni:<%=File.FileSize%>byte</font></td>
        </tr>
        <tr>
          <td width="100%" height="18"><font color="#000080" size="2" face="Tahoma">Tipo:<%=File.ContentType%></font></td>
        </tr>
<%		
	Next

End If
%>
<tr>
          <td width="100%" height="21"></td>
        </tr>
        <tr>
          <td width="100%" align="center" height="65"><input type="submit" name="enter" value="Carica un altro file">
        <p align="center">quando hai finito chiudi questa finestra</p></td>

        </tr>
        <tr>
          <td width="100%" height="21"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</form>

<%
Set Uploader = Nothing

Dim objFSO, objFolder, objFile

Set objFSO = server.createobject("scripting.filesystemobject")
Set objFolder = objFSO.getfolder(strpath)

For Each objFile in objFolder.Files
  Response.Write "

<font color='#000080' size='2' face='Tahoma'>" & objfile.name & " - " & objFile.DateCreated & " - "
  Response.Write objfile.size & " byte - " & objfile.type & "</font>"
Next

set objfolder = Nothing
set objfso = nothing
Response.redirect("loading.asp")
%>
</center>
</body>
</html>


class_upload.asp:

codice:
<%
	If session("Collegato") = "" Then
		Response.Redirect "errore.asp"
	End If
%> 

<%
'***************************************
' File:	  Upload.asp
' Author: Jacob "Beezle" Gilley
' Email:  avis7@airmail.net
' Date:   12/07/2000
' Comments: The code for the Upload, CByteString, 
'			CWideString	subroutines was originally 
'			written by Philippe Collignon...or so 
'			he claims. Also, I am not responsible
'			for any ill effects this script may
'			cause and provide this script "AS IS".
'			Enjoy!
' Modifiche a cura di
' Massimiliano Luciani
' webmaster@byluciani.com
' Ora è possibile gestire la dimensione max
' dei file ed il tipo di estensione
' 22/12/2001
'****************************************

Class FileUploader
	Public  Files
	Private mcolFormElem
	Public maxSize
	Public fileExt
	Public error
	Public errorDesc
	
	Private Sub Class_Initialize()
		Set Files = Server.CreateObject("Scripting.Dictionary")
		Set mcolFormElem = Server.CreateObject("Scripting.Dictionary")
	End Sub
	
	Private Sub Class_Terminate()
		If IsObject(Files) Then
			Files.RemoveAll()
			Set Files = Nothing
		End If
		If IsObject(mcolFormElem) Then
			mcolFormElem.RemoveAll()
			Set mcolFormElem = Nothing
		End If
	End Sub

	Public Property Get Form(sIndex)
		Form = ""
		If mcolFormElem.Exists(LCase(sIndex)) Then Form = mcolFormElem.Item(LCase(sIndex))
	End Property

	Public Default Sub Upload()
		Dim biData, sInputName
		Dim nPosBegin, nPosEnd, nPos, vDataBounds, nDataBoundPos
		Dim nPosFile, nPosBound

		error = False
		errorDesc = ""
		
		'verifico se lo script che ha richiamato la classe
		'ha inizializzato la dimensione max del file
		If Not IsNull(maxSize) Then
			'se il file supera la dimensione stabilita si interrompe la sub
			If Request.TotalBytes > maxSize Then
				Error = True
				errorDesc = "File più grande di " & maxSize & " byte"
				Exit Sub
			End If
		End If

		biData = Request.BinaryRead(Request.TotalBytes)

		nPosBegin = 1
		nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(13)))
		
		If (nPosEnd-nPosBegin) <= 0 Then Exit Sub
		 
		vDataBounds = MidB(biData, nPosBegin, nPosEnd-nPosBegin)
		nDataBoundPos = InstrB(1, biData, vDataBounds)
		
		Do Until nDataBoundPos = InstrB(biData, vDataBounds & CByteString("--"))
			
			nPos = InstrB(nDataBoundPos, biData, CByteString("Content-Disposition"))
			nPos = InstrB(nPos, biData, CByteString("name="))
			nPosBegin = nPos + 6
			nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(34)))
			sInputName = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
			nPosFile = InstrB(nDataBoundPos, biData, CByteString("filename="))
			nPosBound = InstrB(nPosEnd, biData, vDataBounds)
			
			If nPosFile <> 0 And  nPosFile < nPosBound Then
				Dim oUploadFile, sFileName, sFileExt
				Set oUploadFile = New UploadedFile
				
				nPosBegin = nPosFile + 10
				nPosEnd =  InstrB(nPosBegin, biData, CByteString(Chr(34)))
				
				sFileName = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
				sFileName1 = Right(sFileName, Len(sFileName)-InStrRev(sFileName, "\"))
				
				oUploadFile.FileName = Right(sFileName, Len(sFileName)-InStrRev(sFileName, "\"))
				
				'recuperiamo l'estenzione del file
				sfileExt = Right(sFileName1, Len(sFileName1) - InStrRev(sFileName1, "."))
				'verifico se lo script che ha richiamato la classe
				'ha inizializzato il tipo di estenzioni ammesse
				If Not IsNull(fileExt) Then
					'se l'estenzione del file non è incluse tra quelle imposte
					'imterrompiamo la sub
				  If Instr(fileExt, sFileExt) = 0 Then
				  	Error = True
				  	errorDesc = "Tipo di file non ammesso"
				  	Exit Sub
				  End If
				End If

				nPos = InstrB(nPosEnd, biData, CByteString("Content-Type:"))
				nPosBegin = nPos + 14
				nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(13)))
				
				oUploadFile.ContentType = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
				
				nPosBegin = nPosEnd+4
				nPosEnd = InstrB(nPosBegin, biData, vDataBounds) - 2
				oUploadFile.FileData = MidB(biData, nPosBegin, nPosEnd-nPosBegin)
				
				If oUploadFile.FileSize > 0 Then Files.Add LCase(sInputName), oUploadFile
			Else
				nPos = InstrB(nPos, biData, CByteString(Chr(13)))
				nPosBegin = nPos + 4
				nPosEnd = InstrB(nPosBegin, biData, vDataBounds) - 2
				If Not mcolFormElem.Exists(LCase(sInputName)) Then mcolFormElem.Add LCase(sInputName), CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
			End If

			nDataBoundPos = InstrB(nDataBoundPos + LenB(vDataBounds), biData, vDataBounds)
		Loop
	End Sub

	'String to byte string conversion
	Private Function CByteString(sString)
		Dim nIndex
		For nIndex = 1 to Len(sString)
		   CByteString = CByteString & ChrB(AscB(Mid(sString,nIndex,1)))
		Next
	End Function

	'Byte string to string conversion
	Private Function CWideString(bsString)
		Dim nIndex
		CWideString =""
		For nIndex = 1 to LenB(bsString)
		   CWideString = CWideString & Chr(AscB(MidB(bsString,nIndex,1))) 
		Next
	End Function
End Class

Class UploadedFile
	Public ContentType
	Public FileName
	Public FileData
	
	Public Property Get FileSize()
		FileSize = LenB(FileData)
	End Property

	Public Sub SaveToDisk(sPath)
		Dim oFS, oFile
		Dim nIndex
	
		If sPath = "" Or FileName = "" Then Exit Sub
		If Mid(sPath, Len(sPath)) <> "\" Then sPath = sPath & "\"
	
		Set oFS = Server.CreateObject("Scripting.FileSystemObject")
		If Not oFS.FolderExists(sPath) Then Exit Sub
		
		Set oFile = oFS.CreateTextFile(sPath & FileName, True)
		
		For nIndex = 1 to LenB(FileData)
		    oFile.Write Chr(AscB(MidB(FileData,nIndex,1)))
		Next
		oFile.Close
	End Sub
	
	Public Sub SaveToDatabase(ByRef oField)
		If LenB(FileData) = 0 Then Exit Sub
		
		If IsObject(oField) Then
			oField.AppendChunk FileData
		End If
	End Sub

End Class
%>

loading.asp:

codice:
<div align="center">

    

    

    <style type="text/css">
   td.loading { text-align: Center; color: #778899; font: Bold 12px Verdana; }
   td.loading2 { text-align: Center; color: #778899; font: Bold 11px Verdana; }
   td.barra { background-color: #F9F9F9; border: Solid 1px #CCCCCC; }
   #barra { background-color: #EEEEEE; }
   #percentuale { text-align: Center; color: #778899; font: Bold 10px Verdana; }
  </style>
  <script language="javascript" type="text/javascript">
   <!--
    var espandi = 0;
        function Loading() {
           barra.style.width = espandi;
           espandi++;
           percentuale.innerHTML = Math.round(espandi / 2) + "%";
              if (espandi != 200) {
                  window.setTimeout("Loading(), 10");
              }
        }
        function Go() {
           location.href = "inviafile.asp";
        }
        window.setTimeout("Go()", 12000);
   //-->
  </script>