以前幫客戶設計網站時,遇到有需要透過Client端Web interface上傳檔案至Server端需求時,第一首選總會使用ASPSmartUpload,因為這是個既免費又好用的元件,不但有著不錯的穩定性,也有著許多善解人意、淺顯易懂的方法與函數,至今用了好幾年,久了久之,這物件在我心裡也就等於了唯一的上傳元件,習慣了某一樣東西就忘記了世上還有其他美好的東西值得發掘,當然創意與想法也因長期被某一種習慣所牽伴、停頓了。
在段等待當兵的日子裡,總是顯得無趣而沈悶,在沒有接CASE的時候就會想想以前的做的專案是否有功能上延伸的必要,今天突然想到如果當我們上傳很大的檔案(圖片、程式)時,等待的畫面總叫人無聊,如果能有個上傳進度的提示可以增添不少迎接完成的期待感,但是對於我現階段唯一使用的ASPSmartUpload而言,並沒有辦法偵測系統單一執行緒的完成度,在經過網路搜刮資料後,發現ASPUpload可以支援這一項功能,也突顯付費的產品總有比免費的偉大之處。

Progress Bar是ASPUpload 3.0 version後所提供的功能, 以HTML-based為基礎,並以pops up的方式顯示進度。
以下是來自官方的簡介
Starting with Version 3.0, AspUpload offers a unique feature: an HTML-based progress indicator which pops up upon the commencement of an upload and displays the current upload status including the percentage completed and time remaining information. Once an upload is finished or aborted by the user, the progress window automatically closes. This feature is particularly useful when uploading large (over 1 MB) files.
The progress bar is implemented using nothing but HTML and client-side JavaScript. No ActiveX controls or Java applets are used. A typical progress window looks like this:
The layout of the progress window is fully customizable. You can move around the progress bar and numeric indicators, change captions, add custom logos, etc.
閱讀程式碼會發現他是一個相對於Persits.Upload獨立的元件Persits.UploadProgress
上傳前先需為連線Create一個ProgressID供真正上傳時判斷執行緒的識別ID
<%
Set UploadProgress = Server.CreateObject("Persits.UploadProgress")
PID = "PID=" & UploadProgress.CreateProgressID()
%>
整體而言,Persits.Upload的安裝簡單易懂,所提供對檔案系統的操作之方法比ASPSmartUpload多很多,是一個付費Upload元件中不錯的選擇,如果大家有興趣可以參考官方網站:
http://www.aspupload.com/
下載free 30-day AspUpload 3.0.0.6:
http://www.persits.com/aspupload.exe
Progress Bar安裝六步驟
Step 1. If your upload form is located in an .HTML file, you should make it into an .ASP file as some ASP script needs to be added to that file.
Step 2. At the top of your form file (above the actual form), place the following code:
<%
Set UploadProgress = Server.CreateObject("Persits.UploadProgress")
PID = "PID=" & UploadProgress.CreateProgressID()
barref = "framebar.asp?to=10&" & PID
%>
This code is responsible for creating a unique progress ID which connects the page containing the upload form with the progress indicator and upload script.
Step 3. Add the following JavaScript function to your form file below the ASP fragment of Step 2. You may place it between the <HEAD>...</HEAD> tags.
<SCRIPT LANGUAGE="JavaScript">
function ShowProgress()
{
strAppVersion = navigator.appVersion;
if (document.MyForm.FILE1.value != "" || document.MyForm.FILE2.value != "" || document.MyForm.FILE3.value != "")
{
if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
{
winstyle = "dialogWidth=385px; dialogHeight:140px; center:yes";
window.showModelessDialog('<% = barref %>&b=IE',null,winstyle);
}
else
{
window.open('<% = barref %>&b=NN','','width=370,height=115', true);
}
}
return true;
}
</SCRIPT>
The function ShowProgress() is responsible for opening the progress bar window upon submission of your upload form. You may need to change the line
if (document.MyForm.FILE1.value != "" || document.MyForm.FILE2.value != "" || document.MyForm.FILE3.value != "")
according to your own form name and the names of your file item(s). In our example, the form name is MyForm, and the file items are FILE1, FILE2 and FILE3.
Step 4. Add an extra parameter to the ACTION attribute of your upload form, as follows:
<FORM NAME="MyForm" METHOD="POST" ENCTYPE="multipart/form-data"
ACTION="progress_upload.asp?<% = PID %>">
Step 5. Add an OnSubmit attribute to your upload form which calls the ShowProgress() routine added in Step 3, as follows:
<FORM NAME="MyForm" METHOD="POST" ENCTYPE="multipart/form-data"
ACTION="progress_upload.asp?<% = PID %>"
OnSubmit="return ShowProgress();">
Step 5. Make sure the files FRAMEBAR.ASP, BAR.ASP, and NOTE.HTM 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.
Step 6. Add the following line to your upload script right after the CreateObject line:
<%
Set UploadProgress = Server.CreateObject("Persits.Upload")
Upload.ProgressID = Request.QueryString("PID")
...
%>
This tells the UploadManager object the progress ID of the current upload, thereby connecting it to the progress window.
The sample files progress.asp and progress_upload.asp demonstrate a simple progress bar-enabled upload system.
在段等待當兵的日子裡,總是顯得無趣而沈悶,在沒有接CASE的時候就會想想以前的做的專案是否有功能上延伸的必要,今天突然想到如果當我們上傳很大的檔案(圖片、程式)時,等待的畫面總叫人無聊,如果能有個上傳進度的提示可以增添不少迎接完成的期待感,但是對於我現階段唯一使用的ASPSmartUpload而言,並沒有辦法偵測系統單一執行緒的完成度,在經過網路搜刮資料後,發現ASPUpload可以支援這一項功能,也突顯付費的產品總有比免費的偉大之處。

Progress Bar是ASPUpload 3.0 version後所提供的功能, 以HTML-based為基礎,並以pops up的方式顯示進度。
以下是來自官方的簡介
Starting with Version 3.0, AspUpload offers a unique feature: an HTML-based progress indicator which pops up upon the commencement of an upload and displays the current upload status including the percentage completed and time remaining information. Once an upload is finished or aborted by the user, the progress window automatically closes. This feature is particularly useful when uploading large (over 1 MB) files.
The progress bar is implemented using nothing but HTML and client-side JavaScript. No ActiveX controls or Java applets are used. A typical progress window looks like this:
The layout of the progress window is fully customizable. You can move around the progress bar and numeric indicators, change captions, add custom logos, etc.
閱讀程式碼會發現他是一個相對於Persits.Upload獨立的元件Persits.UploadProgress
上傳前先需為連線Create一個ProgressID供真正上傳時判斷執行緒的識別ID
<%
Set UploadProgress = Server.CreateObject("Persits.UploadProgress")
PID = "PID=" & UploadProgress.CreateProgressID()
%>
整體而言,Persits.Upload的安裝簡單易懂,所提供對檔案系統的操作之方法比ASPSmartUpload多很多,是一個付費Upload元件中不錯的選擇,如果大家有興趣可以參考官方網站:
http://www.aspupload.com/
下載free 30-day AspUpload 3.0.0.6:
http://www.persits.com/aspupload.exe
Progress Bar安裝六步驟
Step 1. If your upload form is located in an .HTML file, you should make it into an .ASP file as some ASP script needs to be added to that file.
Step 2. At the top of your form file (above the actual form), place the following code:
<%
Set UploadProgress = Server.CreateObject("Persits.UploadProgress")
PID = "PID=" & UploadProgress.CreateProgressID()
barref = "framebar.asp?to=10&" & PID
%>
This code is responsible for creating a unique progress ID which connects the page containing the upload form with the progress indicator and upload script.
Step 3. Add the following JavaScript function to your form file below the ASP fragment of Step 2. You may place it between the <HEAD>...</HEAD> tags.
<SCRIPT LANGUAGE="JavaScript">
function ShowProgress()
{
strAppVersion = navigator.appVersion;
if (document.MyForm.FILE1.value != "" || document.MyForm.FILE2.value != "" || document.MyForm.FILE3.value != "")
{
if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
{
winstyle = "dialogWidth=385px; dialogHeight:140px; center:yes";
window.showModelessDialog('<% = barref %>&b=IE',null,winstyle);
}
else
{
window.open('<% = barref %>&b=NN','','width=370,height=115', true);
}
}
return true;
}
</SCRIPT>
The function ShowProgress() is responsible for opening the progress bar window upon submission of your upload form. You may need to change the line
if (document.MyForm.FILE1.value != "" || document.MyForm.FILE2.value != "" || document.MyForm.FILE3.value != "")
according to your own form name and the names of your file item(s). In our example, the form name is MyForm, and the file items are FILE1, FILE2 and FILE3.
Step 4. Add an extra parameter to the ACTION attribute of your upload form, as follows:
<FORM NAME="MyForm" METHOD="POST" ENCTYPE="multipart/form-data"
ACTION="progress_upload.asp?<% = PID %>">
Step 5. Add an OnSubmit attribute to your upload form which calls the ShowProgress() routine added in Step 3, as follows:
<FORM NAME="MyForm" METHOD="POST" ENCTYPE="multipart/form-data"
ACTION="progress_upload.asp?<% = PID %>"
OnSubmit="return ShowProgress();">
Step 5. Make sure the files FRAMEBAR.ASP, BAR.ASP, and NOTE.HTM 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.
Step 6. Add the following line to your upload script right after the CreateObject line:
<%
Set UploadProgress = Server.CreateObject("Persits.Upload")
Upload.ProgressID = Request.QueryString("PID")
...
%>
This tells the UploadManager object the progress ID of the current upload, thereby connecting it to the progress window.
The sample files progress.asp and progress_upload.asp demonstrate a simple progress bar-enabled upload system.
test
回覆刪除