欢迎光临
我们一直在努力

ASPUpload上传的实现代码(测试通过)4-ASP教程,组件开发

建站超值云服务器,限时71元/月

uploadfile.asp

<!–#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="">

<meta name="author" content="haiwa">

<title>upload</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

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" onsubmit="return showprogress();">

<input name="file1" type="file" size="16"> <input name="submit" type="submit" value="上 传" onclick="return chk()"></form>

<%end if%>

</body>

</html>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » ASPUpload上传的实现代码(测试通过)4-ASP教程,组件开发
分享到: 更多 (0)