关于aspupload上传组件,文件重命名,进度条的问题解决方案!
共用到4个文件,分别是1.asp,2.asp,bar.asp,framebar.asp
运行第一个文件:1.asp,执行上传操作!
复制代码 代码如下:
<%
'''进度条
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.upfile.filename.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 isPic(){
var temp;
var ExtList = ".jpg.gif.bmp.png.swf";//客户端,检测文件后缀名,省得上传完成后,才报文件类型错误!
var filename = upfile.filename.value;
var the_ext = filename.substr(filename.lastIndexOf(".")+1).toLowerCase();
if (ExtList.indexOf(the_ext)==-1){
alert("不是图片,请选择图片文件!");
return false;
}
return true;
}
//-->
</SCRIPT>
<html>
<head></head>
<body>
<form method="post"enctype="multipart/form-data"action="2.asp?<% = PID %>"name="upfile"OnSubmit="return ShowProgress();">
选择要上传的文件:<br>
<input type=file name="filename"><br>
<input type=submit value="上传" onclick="return isPic()">
内容版权声明:除非注明,否则皆为本站原创文章。