当前位置:首页 » 文件管理 » 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 浏览:190
编译原理上升的箭头 发布:2024-09-27 05:25:24 浏览:223