I'm not sure how to do this with ASP but I know it can be achieved with
www.softartisans.com component FileUp.
I am still learning asp.net so am not sure if there is a way to do this but I expect
there will be, just finding it !!
Regards
Stephen Hutchinson
ps let us know how you get on.
Adding a Server-Side Progress Indicator
--------------------------------------------------------------------------------
FileUp includes a server-side progress indicator, that can be displayed to the user
using HTML. The server-side progress indicator lets you know how much of the entire
upload has arrived at the server. In an upload from the browser to an ASP page,
include the progress indicator in a separate ASP page. In this page, you can get and
display to the user:
The Percentage of the upload that has reached the server.
TotalBytes in the upload.
TransferredBytes so far.
You can use HTML techniques to customize the output effect, and display a counter or a
progress bar.
The following lines are from an application that contains three scripts: form.asp,
formresp.asp and progress.asp. Form.asp submits the file to the upload processing page
formresp.asp. Progress.asp contains the progress indicator.
Form.asp
...
<%
'--- Instantiate the FileUpProgress object.
Set oFileUpProgress = Server.CreateObject("SoftArtisans.FileUpProgress")
'--- Get the next available progress ID.
'--- The progress ID is how the progress indicator and FileUp
'--- sychronize with each other.
intProgressID = oFileUpProgress.NextProgressID
%>
...
<HEAD>
<SCRIPT Language="JavaScript">
<i>/*
This function makes sure that the progress indicator and server-side
processing page receive the new progress ID we just created. Also, it pops up the
progress window.
*/</i>
function startupload() {
winstyle="height=150,width=500,status=no,toolbar=no,menubar=no,location=no";
window.open("progress.asp?progressid=<%=intProgressID%>",null,winstyle);
document.theForm.action="formresp.asp?progressid=<%=intProgressID%>";
}
</script>
</HEAD>
<BODY>
...
<FORM onSubmit="startupload();" name="theForm" ACTION="formresp.asp"
ENCTYPE="MULTIPART/FORM-DATA" METHOD="POST">
<p>Enter Filename:</p>
<INPUT TYPE="FILE" NAME="myFile">
<p>Click "Browse" to select a file to upload</p>
<INPUT TYPE="submit" NAME="SUB1" VALUE="Upload File">
</FORM>
...
Formresp.asp
<%
'--- Instantiate the FileUp object
Set oFileUp = Server.CreateObject("SoftArtisans.FileUp")
'--- Assign the same progress ID that we assigned to the progress object
oFileUp.ProgressID = CInt(Request.QueryString("progressid"))
oFileUp.Path = Server.MapPath(Application("vroot") & "/temp")
...
oFileUp.Form("myFile").Save
...
%>
Progress.asp
<%
'-----------------------------------------------------------------------
'--- This is the progress indicator itself. It refreshes every second
'--- to re-read the file progress properties, which are updated thoughout
'--- the upload.
'-----------------------------------------------------------------------
'--- Declarations
Dim oFileUpProgress
Dim intProgressID
Dim intPercentComplete
Dim intBytesTransferred
Dim intTotalBytes
Dim bDone
intPercentComplete = 0
intBytesTransferred = 0
intTotalBytes = 0
'--- Instantiate the FileUpProgress object
Set oFileUpProgress = Server.CreateObject("Softartisans.FileUpProgress")
'--- Set the ProgressID with the value we submitted from the form page
oFileUpProgress.ProgressID = CInt(Request.QueryString("progressid"))
'--- Read the values of the progress indicator's properties
intPercentComplete = oFileUpProgress.Percentage
intBytesTransferred = oFileUpProgress.TransferredBytes
intTotalBytes = oFileUpProgress.TotalBytes
%>
<html>
<Head>
<%
'--- If the upload isn't complete, continue to refresh
If intPercentComplete < 100 Then
bDone = False
Response.Write("<Meta HTTP-EQUIV=""Refresh"" CONTENT=1>")
Else
bDone = True
End If
%>
</head>
<Body>
<TABLE border=1>
<TR>
<TD colspan=3><B>FileUp Progress Indicator</B></TD>
<TD colspan=2><B>Status: <%If bDone Then Response.Write("Complete!") Else
Response.Write("Sending") End If%></B>
</TR>
<TR><TD>Progress ID </TD>
<TD>Graphic Indicator</TD>
<TD>Transferred Bytes</TD>
<TD>Total Bytes</TD>
<TD>Transferred Percentage</TD>
</TR>
<TR><TD align=left><%=oFileUpProgress.progressid%></TD>
<TD>
<TABLE border=1 cellspacing=0 ALIGN="left"
WIDTH="<%=intPercentComplete%>%">
<TR>
<TD align=right width="100%"
BGCOLOR="blue"><B><%=intPercentComplete%>%</B></TD>
</TR>
</TABLE>
<%
Response.Write("</TD>")
Response.Write "<TD align=center>" & intBytesTransferred & "</TD>"
if oFileUpProgress.totalbytes > 0 then
Response.Write("<TD align=center>" & intTotalBytes & "</TD>" & _
"<TD align=center>" & intPercentComplete & "%</TD>" )
else
Response.Write ("<TD align=center>" & "N/A" & "</TD>" & _
"<TD align=center>" & "N/A" & "</TD>")
end if
Response.Write("</TR>")
%>
</Table>
</Body>
</Html>
> Hi
>
> We are working on VB and ASP projects. In these projects we are
> uploading images/files to the server and we want to display the time
> estimations. But, here we are facing a problem to display the remaining time
> that will take to upload the remaining images/files.
>
> Please help me to solve this problem.
>
> Any ideas or helpful links are welcome.
>
> Thankyou in advance.
>
> Thanks,
> Elan
>
> "Everyone hears what you say. Friends listen to what you say. Best friends
> listen to what you
> don't say."
> --- Tim McGraw
____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set
WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]