📄 manual_progress.html
字号:
<FONT SIZE="1" FACE="Courier New">
<FORM NAME="MyForm" METHOD="POST" ENCTYPE="multipart/form-data"<BR>
ACTION="progress_upload.asp?<% = PID %>"<BR>
<B><FONT COLOR="#FF0000">OnSubmit="return ShowProgress();"</FONT></B>>
</FONT>
<P>
<B>Step 5</B>. Make sure the files <B>FRAMEBAR.ASP</B>, <B>BAR.ASP</B>, and <B>NOTE.HTM</B> are located
in the same directory as your form file. FRAMEBAR.ASP contains the main
frameset for the progress indicator. Under IE, it invokes the file BAR.ASP
within an <IFRAME>. Under Netscape, it invokes the files BAR.ASP and NOTE.HTM
within a regular <FRAMESET>. You only need to modify
the files BAR.ASP and NOTE.HTM to customize your progress indicator.
We do not recommend making any changes to the file FRAMEBAR.ASP, unless
you need to change the size of your progress bar.
<P>
<B>Step 6</B>. Add the following line to your upload script
right after the CreateObject line:
<P>
<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
<TR><TD BGCOLOR="#FFFF00">
<FONT SIZE="1" FACE="Courier New"><B>
<%<BR>
Set UploadProgress = Server.CreateObject("Persits.Upload")<BR>
<FONT COLOR="#FF0000">Upload.ProgressID = Request.QueryString("PID")</FONT><P>
...<BR>
%>
</FONT></TD></TR>
</TABLE>
<P>
This tells the UploadManager object the progress ID of the current
upload, thereby connecting it to the progress window.
<P>
The sample files <B>progress.asp</B> and <B>progress_upload.asp</B> demonstrate a simple
progress bar-enabled upload system.
<P>
Click the link below to run this code sample:
<P>
<B><A TARGET="_new" HREF="http://localhost/aspupload/05_progress/progress.asp">http://localhost/aspupload/05_progress/progress.asp</A></B>
<A HREF="javascript:;" OnClick="open('helppopup.html','','width=400,height=400');"><IMG SRC="help.gif" BORDER="0" ALT="Why is this link not working?"></A>
<P>
</BLOCKQUOTE>
<B><FONT COLOR="#0000A0">Customizing the Progress Bar</FONT></B>
<BLOCKQUOTE>
To change the phrase <I>To cancel uploading, press your browser's <B>STOP</B> button</I>,
make the appropriate modifications in the files <B>FRAMEBAR.ASP</B> (for IE)
and <B>NOTE.HTM</B> (for Netscape).
<P>
All other modifications involve the method <B>UploadProgress.FormatProgress</B>
called in the file <B>BAR.ASP</B>.
<P>
The method <B>FormatProgress</B> expects the following parameters:
<P>
ProgressID<BR>
Iteration (in/out)<BR>
BarColor<BR>
Format<BR>
<P>
<I>ProgressID</i> is a unique ID passed to the file BAR.ASP via the PID variable.<P>
<I>BarColor</i> is the color of the progress bar. By default, this value is "#0000F7".<P>
<i>Iteration</i> will be covered later.<P>
<I>Format</i> is a string containing special characters (described below)
which controls the HTML layout of the progress window.
By default, this value is<P>
<B>"%TUploading files...%t%B3%T%R left (at %S/sec) %r%U/%V(%P)%l%t"</B>
<P>
The format string may contain the following special characters:
<P>
<B>%T</B> - the beginning of an HTML table (<table><tr><td>)<BR>
<B>%t</B> - the end of an HTML table (</td></tr></table>)<BR>
<B>%d</B> - a new column (</td><td>)<BR>
<B>%r</B> - a new column aligned to the right (</td><td align=right>)<BR>
<B>%c</B> - a new column aligned to the center (</td><td align=center>)<BR>
<B>%l</B> - a new row (</td></tr><tr><td>)<BR>
<B>%n</B> - a line break (<br>)<P>
<B>%B<I>n</i></B> - the progress bar; <i>n</i> indicates the number
of percentage points per progress square. Our sample uses <B>%B3</B>.
For a solid progress bar, use <B>%B0</B>.
<P>
The following special characters are placeholders for various
numeric values:
<P>
<B>%E</B> - elapsed time<BR>
<B>%R</B> - remaining time<BR>
<B>%S</B> - current transfer speed<BR>
<B>%U</B> - transferred amount<BR>
<B>%V</B> - total upload size<BR>
<B>%P</B> - percentage completed<BR>
<B>%Y</B> - remaining amount
<P>
The code samples <B>progress1.asp</B>, <B>BAR1.ASP</B> and <B>FRAMEBAR1.ASP</B>
demonstrate a customized progress bar which displays a logo.
The following changes were made to the original files:
<P>
<UL>
<LI>In the file <B>progress1.asp</B>, the barref variable points to FRAMEBAR1.ASP
instead of FRAMEBAR.ASP. Also, the dialog height is increased by 50 points:
<P>
barref = "<FONT COLOR="#FF0000">framebar1.asp</FONT>?to=10&" & PID
<P>
winstyle = "dialogWidth=375px; dialogHeight:<FONT COLOR="#FF0000">180px</FONT>; center:yes";<BR>
...<BR>
window.open('<% = barref %>&b=NN','','width=370,height=<FONT COLOR="#FF0000">165</FONT>', true)<P>
<LI>In the file <B>FRAMEBAR1.ASP</B>, all references to BAR.ASP are replaced
by BAR1.ASP, and the sizes are changed as well:
<P>
<IFRAME src="<FONT COLOR="#FF0000">bar1.asp</FONT>?PID=...
frameborder=0 framespacing=10 width=369 height=<FONT COLOR="#FF0000">115</FONT>></IFRAME><BR>
...<BR>
<FRAMESET ROWS="<FONT COLOR="#FF0000">80%, 20%</FONT>" COLS="100%" border="0" framespacing="0" frameborder="NO"><P>
<LI>In the file <B>BAR1.ASP</B>, the format string is changed as follows:
<P>
"<FONT COLOR="#FF0000"><CENTER><IMG SRC=logo.gif></CENTER></FONT>%TUpload Progress%t%B3%T%R left (at %S/sec) %r%U/%V(%P)%l%t"<P>
<LI>And finally, an image file <B>logo.gif</B> is placed in the appropriate virtual folder.
</UL>
Click the link below to run this code sample:
<P>
<B><A TARGET="_new" HREF="http://localhost/aspupload/05_progress/progress1.asp">http://localhost/aspupload/05_progress/progress1.asp</A></B>
<A HREF="javascript:;" OnClick="open('helppopup.html','','width=400,height=400');"><IMG SRC="help.gif" BORDER="0" ALT="Why is this link not working?"></A>
<P>
</BLOCKQUOTE>
<B><FONT COLOR="#0000A0">Fine-tuning the Progress Bar</FONT></B>
<BLOCKQUOTE>
If something goes wrong with an upload, and the progress bar window
stops receiving signals from the server, it will remain open
for 10 refreshes (roughly 10 seconds as the progress window is refreshed every second).
<P>
This parameter can be changed, if necessary. The value 10 is passed to the
progress bar via the <B>to</B> (time open) variable, as follows:
<P>
barref = "framebar1.asp?<FONT COLOR="#FF0000">to=10</FONT>&" & PID
<P>
This line of code is located in the top portion of your upload form file
(in our case, progress.asp and progress1.asp).
<P>
<A HREF="manual_security.html"><IMG BORDER="0" SRC="next.gif" ALIGN="RIGHT" ALT="Chapter 6: User Impersonation and Permissions"></A>
<A HREF="manual_db.html"><IMG BORDER="0" SRC="previous.gif" ALIGN="RIGHT" ALT="Chapter 4: Saving Files and/or Filenames in the Database"></A>
<P>
</BLOCKQUOTE>
</FONT>
<P>
<TABLE WIDTH=540 HEIGHT=2 CELLSPACING=0 CELLPADDING=0 BORDER=0>
<TD BGcolor="#FFCE00"><spacer type=block width=540 height=2></TD>
</TABLE>
<P>
<CENTER>
<A HREF="index.html"><IMG SRC="logo_small.gif" BORDER=0></A>
<BR>
<FONT Face=arial size=1>
Copyright © 1998 - 2001 <A HREF="http://www.persits.com">Persits Software, Inc.</A><BR>
All Rights Reserved<BR>
AspUpload® is a registered trademark of Persits Software, Inc.<BR>
Questions? Comments? <A HREF="MAILTO:info@aspupload.com">Write us!</A>
</CENTER>
</TD>
</TABLE>
</BASEFONT>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -