Salve. Ho scaricato il seguente script per l'upload di file dal vostro sito ASP:
Ho riscontrato però due errori:codice:<% 'Stores only files with size less than MaxFileSize 'notification address Const NotifyAddress = "info@lasfidacontinua.it" Dim DestinationPath, rHTML DestinationPath = Server.mapPath("UploadFolder") 'Create upload form 'Using Huge-ASP file upload 'Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm") 'Using Pure-ASP file upload Dim Form: Set Form = New ASPForm %><% Server.ScriptTimeout = 2000 Form.SizeLimit = &HA00000 '********************** Form processing '{b}Set the upload ID for this form. 'Progress bar window will receive the same ID. if len(Request.QueryString("UploadID"))>0 then Form.UploadID = Request.QueryString("UploadID")'{/b} end if 'was the Form successfully received? Const fsCompletted = 0 If Form.State = fsCompletted Then 'Completted 'was the Form successfully received? if Form.State = 0 then 'Do something with upload - save, enumerate, ... rHTML = rHTML & " Upload result: Form was accepted." rHTML = rHTML & " Number of file fields:" & Form.Files.Count rHTML = rHTML & " Request total bytes:" & Request.TotalBytes Form.Files.Save DestinationPath rHTML = rHTML & " Files was saved to " & DestinationPath & " folder." End If ElseIf Form.State > 10 then Const fsSizeLimit = &HD Select case Form.State case fsSizeLimit: rHTML = rHTML & " <Font Color=red>Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)</Font> " case else rHTML = rHTML & " <Font Color=red>Some form error.</Font> " end Select End If'Form.State = 0 then response.write rHTML '********************** Notification if Request.ServerVariables("REQUEST_METHOD") = "POST" then 'Create a report email Set objNewMail = CreateObject("CDONTS.NewMail") Const CdoMailFormatMime = 0 objNewMail.MailFormat = CdoMailFormatMime objNewMail.BodyFormat = 0 ' HTML Subject = "Upload of files - user '" & request.servervariables("REMOTE_USER") & "'" Message = rHTML Message = Message & " Time: " & Now Message = Message & " Total size:" & Form.TotalBytes & "B (" & Form.TotalBytes \1024 + 1 & "kB)" Message = Message & " Fields:" Dim Field For each Field In Form.Items.Items Message = Message & " " & Field.Name & ":" if Field.isFile then if len(Field.FileName)>0 then Message = Message & " file " & Field.FileName & "," & Field.Length \1024 + 1 & "kB" else'if len(Field.FileName)>0 then Message = Message & " empty file field." end if'if len(Field.FileName)>0 then else'if Field.isFile then Message = Message & " text '" & Field.String & "'" end if 'if Field.isFile then Next 'Send the new email objNewMail.Send "Huge-ASP upload", NotifyAddress, Subject, Message End If '********************** HTML Form prepare '{b}get an unique upload ID for this upload script and progress bar. Dim UploadID, PostURL UploadID = Form.NewUploadID 'Send this ID as a UploadID QueryString parameter to this script. PostURL = Request.ServerVariables("SCRIPT_NAME") & "?UploadID=" & UploadID'{/b} %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <TITLE>ASP huge file upload - upload with administrator email notification.</TITLE> <STYLE TYPE="text/css"></STYLE> <meta name="robots" content="noindex,nofollow"> </HEAD> <BODY BGColor=white> <Div style=width:600> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TR> <TH noWrap align=left width="20%" bgColor=khaki><A href="http://asp-upload.borec.net">Power ASP file upload</A> - upload with administrator email notification.</TH> <TD></TD></TR></TABLE> <TABLE cellSpacing=2 cellPadding=1 width="100%" bgColor=white border=0> <TR> <TD colSpan=2> Form size limit is <%=Form.SizeLimit \ 2048 %>kB Destination folder is <%=DestinationPath%> Administrator email address <%=NotifyAddress%> </P> </TD></TR></TABLE> <form name="file_upload" method="POST" ENCTYPE="multipart/form-data" OnSubmit="return ProgressBar();" Action="<%=PostURL%>"> <Div ID=files> File 1 : <input type="file" name="File1"> File 2 : <input type="file" name="File2"> File 3 : <input type="file" name="File3"> </Div> <Input Type=Button Value="Aggiungi un file" OnClick=return(Expand()) Style="border=0;background=yellow;cursor:hand"> Descrizione: <input Name=Description1 Size=60> <input Name=SubmitButton Value="Invia »" Type=Submit> </Form> <SCRIPT> //Open window with progress bar. function ProgressBar(){ var ProgressURL ProgressURL = 'progress.asp?UploadID=<%=UploadID%>' var v = window.open(ProgressURL,'_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=350,height=200') return true; } </SCRIPT> <Script> //Expand form with a new File fields if needed. var nfiles = 3; function Expand(){ nfiles++ var adh = ' File '+nfiles+' : <input type="file" name="File'+nfiles+'">'; files.insertAdjacentHTML('BeforeEnd',adh); return false; } </Script> <HR COLOR=silver Size=1> <CENTER> <FONT SIZE=1>© 1996 – <%=year(date)%> Antonin Foller, Motobit Software, e-mail help@pstruh.cz To monitor current running uploads/downloads, see IISTracer - IIS real-time monitor. </FONT> </CENTER> </Div> </BODY></HTML>
1) La mail di conferma di upload non viene inviata (dovrebbe farlo);
2) L'upload viene eseguito correttamente, solo che successivamente viene aperta la pagina "Impossibile visualizare la pagina".
Potete gentilmente aiutarmi a risolvere questi due problemi?
Grazie mille
Roberto
![]()

);
Rispondi quotando

