一个上传函数的类(怎么只能20M呢?)

作者在 2006-11-03 19:11:00 发布以下内容

<!--
文件上传

-->
<!--#include file="config.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Upload Files</title>
<style>
<!--

BODY{background:#ffffff;}      
.p9{ font-size: 9pt; font-family: 宋体}
.tx { width: 200 ;height: 20px; font-size: 9pt; border: 1px solid; border-color: black black #000000; color: #0000FF}
.tx1 { width: 50 ;height: 20px; font-size: 9pt; border: 1px solid; border-color: black black #000000; color: #ff0000}
-->
</style>
<body leftmargin="0" topmargin="2" class="p9">
<%
If request("action")="music" then
'====上传歌曲开始====
if Request.QueryString("submit")="music" Then
Set Uprequest=new UpLoadClass
    Uprequest.SavePath=uploadpath
    Uprequest.MaxSize=uploadsize*1024
    Uprequest.FileType=uploadtype
    AutoSave=true
    Uprequest.open
  if Uprequest.form("file_Err")<>0  then
  select case Uprequest.form("file_Err")
  case 1:str="<div style=""padding-top:5px;padding-bottom:5px;""> <font color=blue>上传不成功!文件超过"&uploadsize&"k [<a href='javascript:history.go(-1)'>重新上传</a>]</font></div>"
  case 2:str="<div style=""padding-top:5px;padding-bottom:5px;""> <font color=blue>上传不成功!文件格式不对 [<a href='javascript:history.go(-1)']>重新上传</a>]</font></div>"
  case 3:str="<div style=""padding-top:5px;padding-bottom:5px;""> <font color=blue>上传不成功!文件太大且格式不对 [<a href='javascript:history.go(-1)'>重新上传</a>]</font></div>"
  end select
  response.write str
  else
  response.write "<script language=""javascript"">parent.form2.file.value='"&Uprequest.SavePath&Uprequest.Form("file")&"';"
  response.write "</script>"
  response.write "<div style=""padding-top:5px;padding-bottom:5px;""> <font color=red>文件上传成功</font> [<a href='javascript:history.go(-1)'>重新上传</a>]</div>"
  end if
Set Uprequest=nothing
end if
response.write "<form name='form' action=?action=music&submit=music method=post enctype=multipart/form-data>"
response.write "<input type=file name=file class='tx' size='20'>&nbsp;"
response.write "<input type=submit name=submit value=上传 class=""tx1"">"
response.write "</form>"
End If
'============================================================上传函数
Class UpLoadClass

 Private p_MaxSize,p_FileType,p_SavePath,p_AutoSave,p_Error
 Private objForm,binForm,binItem,strDate,lngTime
 Public FormItem,FileItem

 Public Property Get Version
  Version="Rumor UpLoadClass Version 2.0"
 End Property

 Public Property Get Error
  Error=p_Error
 End Property

 Public Property Get MaxSize
  MaxSize=p_MaxSize
 End Property
 Public Property Let MaxSize(lngSize)
  if isNumeric(lngSize) then
   p_MaxSize=clng(lngSize)
  end if
 End Property

 Public Property Get FileType
  FileType=p_FileType
 End Property
 Public Property Let FileType(strType)
  p_FileType=strType
 End Property

 Public Property Get SavePath
  SavePath=p_SavePath
 End Property
 Public Property Let SavePath(strPath)
  p_SavePath=replace(strPath,chr(0),"")
 End Property

 Public Property Get AutoSave
  AutoSave=p_AutoSave
 End Property
 Public Pro

WEB开发 | 阅读 1842 次
文章评论,共0条
游客请输入验证码
浏览106139次