免费PHP万能建站系统_社区团购SaaS_商城系统_软件开发_虚拟币交易所系统_矿机系统_微信钻石投票系统_成品源码

标题: AspUpload 3.0上传组件和例子代码(带进度条) [打印本页]

作者: admin_2    时间: 2014-8-1 10:52
标题: AspUpload 3.0上传组件和例子代码(带进度条)

请先下载AspUpload 3.0上传组件 [attach]587[/attach]
组件中包含了上传代码例子(ASP)

上传进度条如图所示:
[attach]588[/attach]


uploadfile.asp代码,其它代码参见 rar包中文件


[mw_shl_code=vbnet,true]<!--#include file='fileconfig.asp'-->
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Keywords" content="51windows.Net">
<meta name="Author" content="haiwa">
<title>Upload -51windows.Net</title>
<style>
<!--
*         {font:12px;}
-->
</style>
</head>
<body>
<%
On Error Resume Next
Server.ScriptTimeOut=999999
if request("act")="upload" then
        dim folder,savepath
        savepath=Server.MapPath(UploadFilePath)
        CreateFolder(savepath)
        Set Upload=Server.CreateObject("Persits.Upload")
        Upload.SetMaxSize UploadLimitSize*1024, True
        Upload.OverwriteFiles = false
        if Request.QueryString("PID") = "" then
                Upload.ProgressID="010D60EB00C5AA4B"
        else
                Upload.ProgressID=Request.QueryString("PID")
        end if
        Count=Upload.Save(savepath)
        If Err.Number <> 0 Then
                Response.Write "<div style=""color:red;font-size:12px;"">出现错误: " & Err.Number & "、" & Err.Description &"<a href=""javascript:history.go(-1)"">重新上传</a></div>"
        End If
        If Err.Number = 8 Then
                Response.Write "<div style=""color:red;font-size:12px;"">你上传的文件超过限制("& UploadLimitSize/1024 &"M)<a href=""javascript:history.go(-1)"">重新上传</a></div>"
                response.end
        end if
        dim inputname
        dim size,rs_upfile
        For Each File in Upload.Files
                if not  CanUpload(File.ext) then
                        File.Delete
                        response.write "<div style=""color:red;font-size:12px;"">"&file.filename &"("& file.size &") 格式不正确!<a href=""javascript:history.go(-1)"">重新上传</a></div>"
                else
                        '这下面三行代码功能为改名,如果不要改名,请去掉
                        dim NewName
                        NewName = year(now) & "-" & month(now) & "-" & day(now) & "-" & hour(now) & "-" & minute(now) & "-" & second(now) &  File.ext
                        File.Move savepath & "\" & NewName
                        response.write "<div style=""color:green;font-size:12px;""><!-- "&file.filename &"("& file.size &") --> 上传成功"%><a href="javascript:history.go(-1)">重新上传</a></div><%
                end if
        next
else
%>
<%
dim SPid,PID,barref
Set UploadProgress = Server.CreateObject("Persits.UploadProgress")
SPid = UploadProgress.CreateProgressID()
PID = "PID=" & SPid
barref = "framebar.asp?to=10&" & PID
%>
<SCRIPT LANGUAGE="JavaScript">
function ShowProgress()
{
  strAppVersion = navigator.appVersion;
  if (document.MyForm.FILE1.value != "")
  {
    if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
    {
      winstyle = "dialogWidth=375px; dialogHeight:175px; center:yes;status:no";
      window.showModelessDialog('<% = barref %>&b=IE',window,winstyle);
    }
    else
    {
      window.open('<% = barref %>&b=NN','','width=370,height=165', true);
    }
  }
  return true;
}
function chk()
{
        if (MyForm.FILE1.value=="")
        {
                alert("请从硬盘选择你要上传的文件...");
                return false;
        }
}
</SCRIPT>
<FORM NAME="MyForm" method="post" ENCTYPE="multipart/form-data" ACTION="?<% = PID %>&act=upload">
<INPUT NAME="FILE1" TYPE="FILE" SIZE="16"> <input name="Submit" type="submit" value="上 传"></FORM>
<%end if%>
</body>
</html>[/mw_shl_code]


20046191721274487_uploadbar.gif (10.15 KB, 下载次数: 1976)

20046191721274487_uploadbar.gif

aspupload.rar

778.42 KB, 下载次数: 1


作者: 云时代网络    时间: 2014-8-12 10:24
very good

作者: zsc2010520    时间: 2014-8-12 10:43
广告位,,坐下看看
作者: 壞^_^亾sa↓y    时间: 2014-8-12 10:46
鼎力支持!!

作者: cj13888    时间: 2014-8-12 10:49
小白一个 顶一下

作者: movsw    时间: 2014-8-16 07:35
加油YIDACMS
作者: htlugg    时间: 2014-8-16 07:39
YIDACMS真心不错,推荐给大家
作者: 5204105    时间: 2014-8-16 08:04
不错,今天是开眼了





欢迎光临 免费PHP万能建站系统_社区团购SaaS_商城系统_软件开发_虚拟币交易所系统_矿机系统_微信钻石投票系统_成品源码 (https://ourphp.net/club/) Powered by Discuz! X3.2