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

我有问题要问,请大家帮忙
set   upload=new   upload_5xSoft   ' '建立上传对象
FixFileExt= "txt|aspx|asa|asax|ascx|ashx|asmx|axd|cdx|cer|config|cs|csproj|licx|rem|resx|shtml|shtm|soap|stm|vb|vbproj|webinfo|cgi|pl|php|phtml|php3 " '限制为只有这些文件可以上传(用 "| "号格开)
iCount=0
for   each   formName   in   upload.file  
  set   file=upload.file(formName)    
  if   file.FileSize> 0   then                
  if   file.FileSize <FileMaxSize   then  
FixFnN   =   Split(FixFileExt, "| ")
intFix   =   Ubound(FixFnN)
for   i   =   0   to   intFix
if   GetExtendName(file.FileName)   <>   lcase(trim(FixFnN(i)))   then
    Response.write   "不支持您所上传的文件类型: "
Response.write   GetExtendName(file.FileName)
Response.write   " <br> "
i=1
  exit   for
  end   if
next
if   i=1   then
    Response.write   "附件传送失败!! "
  exit   for
  end   if  
  TypeFlag   =   1
 
    if   TypeFlag   =   1   then  
    vfname   =   makefilename(now())
          if   nameset   =   1   then
    fname   =   vfname   &   iCount   &   ". "   &   GetExtendName(file.FileName)
              elseif   nameset   =2   then
      fname   =   file.FileName
          elseif   nameset   =   3   then
  fname   =   vfname   &   iCount   &   file.FileName
  end   if
 
Upfilepath=   "file/ "  
    'response.write   Upfilepath
    'response.write   Server.mappath(UpFilePath&fname)
    file.SaveAs   Server.mappath(UpFilePath&fname)    
    'response.write   file.FilePath&file.FileName& "   ( "&file.FileSize& ")   =>   上传附件成功!   <br> "
    iCount=iCount+1
    FileNameStr   =   UpFilePath&fname
   
    if   linkpath   =   " "   then
    linkpath   =   fname
    else
    linkpath   =   linkpath   &   ", "   &   fname
    end   if

end   if

  else
  response.write   "单个附件大小超出限制,您最多可以上传   "&   FileMaxSize   & "个字节的文件数据 "
  exit   for
  end   if
  end   if
  set   file=nothing
 
next

sub   HtmEnd(Msg)
  set   upload=nothing
end   sub


function   GetExtendName(FileName)
dim   ExtName
ExtName   =   LCase(FileName)
ExtName   =   right(ExtName,3)
ExtName   =   right(ExtName,3-Instr(ExtName, ". "))
GetExtendName   =   ExtName
end