i found this very simple but exactly what i wanted upload script for asp.
i really wanted one in php but it involves too much which i can do on my windows apache system as far as i know. anyway.
i have the mod_perl mod_asp etc etc bundle of windows port of apache.
i dont understand asp at all or know how to program it. i just need an upload script with progress bar. like this it works in the demo just fine.
the script seems to return 500 errors to the browser and the error log for server includes the following...
Code:
[Sat Jun 14 05:34:25 2003] [error] [asp] [2892] [debug] Bareword found where operator expected at f:/apache/asp/progressbar.asp line 11, near ") <--> theProgress" <-->
[Sat Jun 14 05:34:25 2003] [error] [asp] [2892] [debug] (Missing operator before theProgress?) <-->
[Sat Jun 14 05:34:25 2003] [error] [asp] [2892] [error] error compiling progressbar.asp: syntax error at f:/apache/asp/progressbar.asp line 11, near ") <--> theProgress" <--> , f:/Apache/Perl/site/lib/Apache/ASP.pm line 1432
[Sat Jun 14 05:34:54 2003] [error] [asp] [2892] [debug] Bareword found where operator expected at f:/apache/asp/progressupload.asp line 3, near "10000 <--> Server" <-->
[Sat Jun 14 05:34:54 2003] [error] [asp] [2892] [debug] (Missing operator before Server?) <-->
[Sat Jun 14 05:34:54 2003] [error] [asp] [2892] [debug] Bareword found where operator expected at f:/apache/asp/progressupload.asp line 5, near "300 <--> Set" <-->
[Sat Jun 14 05:34:54 2003] [error] [asp] [2892] [debug] (Missing operator before Set?) <-->
[Sat Jun 14 05:34:54 2003] [error] [asp] [2892] [debug] Bareword found where operator expected at f:/apache/asp/progressupload.asp line 6, near ") <--> theForm" <-->
[Sat Jun 14 05:34:54 2003] [error] [asp] [2892] [debug] (Missing operator before theForm?) <-->
[Sat Jun 14 05:34:54 2003] [error] [asp] [2892] [debug] Bareword found where operator expected at f:/apache/asp/progressupload.asp line 8, near "8000000 <--> theForm" <-->
[Sat Jun 14 05:34:54 2003] [error] [asp] [2892] [debug] (Missing operator before theForm?) <-->
[Sat Jun 14 05:34:54 2003] [error] [asp] [2892] [debug] Bareword found where operator expected at f:/apache/asp/progressupload.asp line 9, near ") <--> Set" <-->
[Sat Jun 14 05:34:54 2003] [error] [asp] [2892] [debug] (Missing operator before Set?) <-->
[Sat Jun 14 05:34:54 2003] [error] [asp] [2892] [debug] Bareword found where operator expected at f:/apache/asp/progressupload.asp line 10, near ") <--> If" <-->
[Sat Jun 14 05:34:54 2003] [error] [asp] [2892] [debug] (Missing operator before If?) <-->
[Sat Jun 14 05:34:54 2003] [error] [asp] [2892] [error] error compiling progressupload.asp: syntax error at f:/apache/asp/progressupload.asp line 3, near "10000 <--> Server" <--> , f:/Apache/Perl/site/lib/Apache/ASP.pm line 1432
the two asp script files and one html file these are as below....
file 1 "progressupload.asp"
Code:
<%
Response.Expires = -10000
Server.ScriptTimeOut = 300
Set theForm = Server.CreateObject("Upload.Form")
theForm.Overwrite = True
theForm.MaxUploadSize = 8000000
theForm.ID = Request.QueryString("ID")
Set theField = theForm.Files("filefield1")
If theField.FileExists Then
theField.Save theField.FileName
End If
%>
<html>
<body>
Upload Complete...
</body>
</html>
file 2 "progressbar.asp"
Code:
<%@EnableSessionState=False%>
<html>
<head>
<title>Progress...</title>
<meta http-equiv="expires" content="Tue, 01 Jan 1981 01:00:00 GMT">
<meta http-equiv=refresh content="2,progressbar.asp?ID=<%=Request.QueryString("ID")%>">
<%
On Error Resume Next
Set theProgress = Server.CreateObject("Upload.Progress")
theProgress.ID = Request.QueryString("ID")
%>
<script language="javascript">
<!--
if (<% =theProgress.PercentDone %> == 100) top.close();
//-->
</script>
</head>
<body bgcolor="#CCCCCC">
<table border="0" width="100%">
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Uploading:</b></font></td>
</tr>
<tr bgcolor="#999999">
<td>
<table border="0" width="<%=theProgress.PercentDone%>%" cellspacing="1" bgcolor="#0033FF">
<tr>
<td><font size="1"> </font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" width="100%">
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Estimated time left:</font></td>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<%=Int(theProgress.SecondsLeft / 60)%> min
<%=theProgress.SecondsLeft Mod 60%> secs
(<%=Round(theProgress.BytesDone / 1024, 1)%> KB of
<%=Round(theProgress.BytesTotal / 1024, 1)%> KB uploaded)</font></td>
</tr>
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
Transfer Rate:</font></td>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<%=Round(theProgress.BytesPerSecond/1024, 1)%> KB/sec</font></td>
</tr>
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Information:</font></td>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><%=theProgress.Note%></font></td>
</tr>
</table>
</td>
</tr>
<tr></tr>
</table>
</body>
</html>
finally file 3 "progressupload.htm"
Code:
<html>
<body>
<script language="javascript">
<!--
function DoUpload() {
theFeats = "height=120,width=500,location=yes,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no";
theUniqueID = (new Date()).getTime() % 1000000000;
window.open("progressbar.asp?ID=" + theUniqueID, theUniqueID, theFeats);
document.myform.action = "progressupload.asp?ID=" + theUniqueID;
document.myform.submit();
}
//-->
</script>
<form name="myform" method="post" action="progressupload.asp" enctype="multipart/form-data">
<input type="file" name="filefield1"><br>
<input type="button" name="dosubmit" value="Upload" OnClick="DoUpload()"><br>
</form>
</body>
</html>
Thank you very much for any help in advance. as i am i total noobie to asp
regards
rob