当前位置:编程学习 > asp >>

ASPUpload上传的实现代码(测试通过)4

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
补充:asp教程,组件开发 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,