日期:2014-05-17  浏览次数:21196 次

这是一个上传图片的类文件!上传图片没问题,但怎样改才能上传视频呢?谢谢了
<%
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= "E-Kemp   V1.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   Property   Let   AutoSave(byVal   Flag)
select   case   Flag
case   0:
case   1:
case   2:
case   false:Flag=2
case   else:Flag=0
end   select
p_AutoSave=Flag
End   Property

Private   Sub   Class_Initialize
p_Error       =   -1
p_MaxSize     =   153600
p_FileType   =   "jpg/gif/wav "
p_SavePath   =   "../up_img/ "
p_AutoSave   =   2
strDate       =   replace(cstr(Date()), "- ", " ")
lngTime       =   clng(timer()*1000)
Set   binForm   =   Server.CreateObject( "ADODB.Stream ")
Set   binItem   =   Server.CreateObject( "ADODB.Stream ")
Set   objForm   =   Server.CreateObject( "Scripting.Dictionary ")
objForm.CompareMode   =   1
End   Sub

Private   Sub   Class_Terminate
objForm.RemoveAll
Set   objForm   =   nothing
Set   binItem   =   nothing
binForm.Close()
Set   binForm   =   nothing
End   Sub

Public   Sub   Open()
if   p_Error=-1   then
p_Error=0
else
Exit   Sub
end   if
Dim   lngRequestSize,binRequestData,strFormItem,strFileItem
Const   strSplit= " ' " "> "
lngRequestSize=Request.TotalBytes
if   lngRequestSize <1   then
p_Error=4
Exit   Sub
end   if
binRequestData=Request.BinaryRead(lngRequestSize)
binForm.Type   =   1
binForm.Open
binForm.Write   binRequestData

------解决方案--------------------
p_FileType = "jpg/gif/wav "
加你要上傳的其他格式
------解决方案--------------------
p_MaxSize = 153600 '上传文件的大小限制
p_FileType = "jpg/gif/wav " '上传文件类型
p_SavePath = "../up_img/ " '存储上传文件的目录