當前位置:首頁 » 文件管理 » asp進度條上傳

asp進度條上傳

發布時間: 2024-09-27 04:16:17

Ⅰ asp關於文件的上傳和下載功能

先說明一下:
一、組件上傳,在使用方法上,使用代碼少,更安全,更容易控制,並且功能更強大,比如可以實現控制上傳圖片的尺寸,可以實現真實的上傳進度條等,並且上傳圖片後可以進行對圖片進行編輯等。但缺點是要求服務必需安裝這個組件,如果是自己的伺服器還好辦,如果你是租用空間的話,那麼最好放棄組件上傳吧。
二、無組件上傳,在使用上相對稍復雜一點,需要你到網上下載一個「ASP無組件上傳類」(一般為一個.inc文件),不能對圖片進行處理,只可以控制上傳的文件類型,文件大小等,優點是對伺服器無要求,租用的伺服器空間絕大多數都可以使用。

綜上所述,對於一般小站或企業網站,上傳文件不多,文件不大,要求不高的都使用無組件上傳。

目前較流行的 無組件上傳類有:
化境ASP無組件上傳類
風聲ASP無組件上傳類
艾恩ASP無組件上傳類
等,你在網路里搜索以上關鍵字,找到官方網站,可以免費下載相關上傳類,並且有詳細用法說明,及例子。

Ⅱ asp 如何實現帶進度條的上傳文件功能

以下就以abcupload4為例來說明怎麼來製作實時的文件上傳進度條。

(註:我們在abcupload自帶例子基礎上改進。)

progressupload.htm(上傳文件的前台提交,我們讓進度條在這個裡面顯示)

<HTML>

<body>

<script language="javascript">

<!--

theUniqueID = (new Date()).getTime() % 1000000000;

function s() //讓數據提交的同時執行顯示進度條的函數

{

bar(); //開始執行反映上傳情況的函數

document.myform.action = "progressupload.ASP?ID=" theUniqueID; //處理上傳數據的程序

document.myform.target="up" //將提交的數據放在一個名字是up隱藏的iframe裡面處理,這樣提交的頁面就不會跳轉到處理數據的頁

document.myform.submit(); //提交表單

}

function bar()

{

bar1.style.display=''; //讓顯示上傳進度顯示的層的可見

var timeoutid=null; //這個變數是作定時器的ID

var oXMLDoc = new ActiveXObject('MSXML'); //創建'MSXML'對象

sURL = "progressbar.ASP?ID=" theUniqueID "&temp=" Math.random(); //獲取上傳狀態數據的地址

oXMLDoc.url = sURL; //load數據

var oRoot=oXMLDoc.root; //獲取返回XML數據的根節點

if(oRoot.children != null)

{

if (oRoot.children.item(0).text-100==0) //文件上傳結束就取消定時器

clearTimeout(timeoutid)

PercentDone.style.width=oRoot.children.item(0).text "%"; //設置進度條的百分比例

//根據返回的數據在客戶端顯示

min.innerHTML=oRoot.children.item(1).text; //顯示剩餘時間(分鍾)

secs.innerHTML=oRoot.children.item(2).text; //顯示剩餘時間(秒鍾)

BytesDone.innerHTML=oRoot.children.item(3).text; //已上傳數據大小

BytesTotal.innerHTML=oRoot.children.item(4).text; //總大小

BytesPerSecond.innerHTML=oRoot.children.item(5).text; //傳輸速率

Information.innerHTML=oRoot.children.item(6).text; //上傳信息

}

if (oRoot.children.item(0).text-100<0) //只要文件沒有傳完,就每隔多少時間獲取一次數據

timeoutid = setTimeout("bar()",50) //這里設定時間間隔是0.05秒,你也可以根據你的情況修改獲取數據時間間隔

}

//-->

</script>

<form name="myform" method="post" action="progressupload.ASP" enctype="multipart/form-data" target=up>

<input type="file" name="filefield1"><br>

<input type="button" name="dosubmit" value="Upload" onclick="s()"><br>

<div id=bar1 style="display:none">

<table border="0" width="100%">

<tr>

<td><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>傳送:</b></font></td>

</tr>

<tr bgcolor="#999999">

<td>

<table border="0" width="" cellspacing="1" bgcolor="#0033FF" id=PercentDone>

<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">剩餘時間:</font></td>

<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">

<span id=min></span> 分

<span id=secs></span> 秒

(<span id=BytesDone></span> KB of

<span id=BytesTotal></span> KB 已上傳)</font></td>

</tr>

<tr>

<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">

傳送速度:</font></td>

<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">

<span id=BytesPerSecond></span> KB/秒</font></td>

</tr>

<tr>

<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">信息:</font></td>

<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><span id=Information></span></font></td>

</tr>

</table>

</td>

</tr>

<tr></tr>

</table>

</div>

<iframe name="up" style="display:none"></iframe>

</form>

</body>

</HTML>

progressbar.ASP(返回上傳狀況數據的文件)

<%@EnableSessionState=False%>

<%

On Error Resume Next

Set theProgress = Server.CreateObject("ABCUpload4.XProgress") '創建上傳組件對象

theProgress.ID = Request.QueryString("ID")

'將返回數據以XML格式輸出

%>

<?XML version="1.0" encoding="gb2312" ?>

<plan>

<PercentDone><%=theProgress.PercentDone%></PercentDone>

<min><%=Int(theProgress.SecondsLeft/60)%></min>

<secs><%=theProgress.SecondsLeft Mod 60%></secs>

<BytesDone><%=Round(theProgress.BytesDone / 1024, 1)%></BytesDone>

<BytesTotal><%=Round(theProgress.BytesTotal / 1024, 1)%></BytesTotal>

<BytesPerSecond><%=Round(theProgress.BytesPerSecond/1024, 1)%></BytesPerSecond>

<Information><%=theProgress.Note%></Information>

</plan>

progressupload.ASP(處理上傳文件)

<%@EnableSessionState=False%>

<%

Response.Expires = -10000

Server.ScriptTimeOut = 300

Set theForm = Server.CreateObject("ABCUpload4.XForm")

theForm.Overwrite = True

theForm.MaxUploadSize = 8000000

theForm.ID = Request.QueryString("ID")

Set theField = theForm("filefield1")(1)

If theField.FileExists Then

theField.Save theField.FileName

End If

%>

<HTML>

<body>

傳送結束

</body>

</HTML>

Ⅲ 急!ASP.NET+Ajax實現視頻文件上傳帶進度條

我建議用flash的吧,現在有兩個比較強大的,一個是swfupload另一個是uploadify,兩者都是任何語言都可以使用的,提供了介面,兩種我都用了,雖然剛開始研究有些吃力,但研究好了,你會發現,你的最終選擇會是這兩個,網上的垃圾確實很多。希望可以幫到你。

熱點內容
graham凸包演算法 發布:2024-09-27 07:11:59 瀏覽:93
寫小說的怎麼上傳 發布:2024-09-27 07:10:30 瀏覽:4
國內的伺服器可以搭建v2嗎 發布:2024-09-27 07:09:34 瀏覽:994
指定資料庫所在伺服器ip怎麼找 發布:2024-09-27 06:33:54 瀏覽:326
linux安裝google 發布:2024-09-27 06:33:46 瀏覽:107
euclid演算法 發布:2024-09-27 06:20:22 瀏覽:642
java銀行賬戶類 發布:2024-09-27 06:20:12 瀏覽:908
linux內核編譯重新 發布:2024-09-27 06:18:45 瀏覽:461
解壓拓展項目 發布:2024-09-27 05:43:16 瀏覽:191
編譯原理上升的箭頭 發布:2024-09-27 05:25:24 瀏覽:223