当前位置:首页
开发技术指南» 文章正文
    引言:

    摘要: 如题 ......
    摘要: 如题,各位给点意见,谢谢啊 ......


求能规定上传文件后缀名的无组件上传代码

具体要求是能限制上传文件缀名的,上传文件放在指定文件夹中,路径存放在数据库中

NO.1   作者: RoseKnife

...........................  
   
    set   file=upload.file(formName)                                           生成一个文件对象  
      if   file.FileSize>0   and   file.filesize<400000   then     如果   FileSize   >   0   说明有文件数据  
              检查文件类型  
              fn=Lcase(right(file.filename,3))  
              if   fn="gif"   or   fn="jpg"   or   fn="bmp"   or   fn="png"   then  
   
  .......................

NO.2   作者: 3573745

不要想。目前只有一种大众化的无组上传   冬冬   upload_5xSoft  
  下面是我曾经做相册   的代码。你随便改改就行  
  你要的参数和功能都包括得有!  
   
  imgname=year(now())&month(now())&day(now())&hour(now())&minute(now())&second(now())  
   
  set   upload=new   upload_5xSoft  
  formPath=formPath  
  set   file=upload.file("file1")  
  imgform=lcase(right(file.filename,3))        
  imgname=imgname&"."&imgform  
  imgform=lcase(right(file.filename,3))      
    if   imgform<>"gif"   and   imgform<>"jpg"   and   imgform<>"png"   and   imgform<>"bmp"   then  
    response.write   "<script   language=javascript>"   &   VbCRlf  
  response.write   "alert(上传文件格式不对!);"   &   VbCrlf  
  response.write   "history.go(-1);"   &   vbCrlf  
  response.write   "</script>"   &   VbCRLF  
  response.end  
    end   if  
    if   file.filesize>500000   then  
    response.write   "<script   language=javascript>"   &   VbCRlf  
  response.write   "alert(上传文件大小超过限制500K);"   &   VbCrlf  
  response.write   "history.go(-1);"   &   vbCrlf  
  response.write   "</script>"   &   VbCRLF  
  response.end  
    end   if    
  imgsize=file.FileSize  
  imgsize=formatnumber((imgsize   /   1024),2)  
  formPath="upload"&"/"  
  if   file.FileSize>0   then                   如果   FileSize   >   0   说明有文件数据  
  fileName=file.FileName  
   
  file.SaveAs   Server.mappath(formPath&imgname)       保存文件                                      
  end   if  
  imglen=len(filename)  
  imglen=imglen-4  
  filename=left(filename,imglen)  
  esponse.write   "<script>window.opener.document.writeform.imgname.value+="&imgname&"</script>"  
    response.write   "<script>window.opener.document.writeform.size.value="&imgsize&"   k</script>"  
    response.write   "<script>window.opener.document.writeform.name.value="&filename&"</script>"  
  set   file=nothing      
 


 ·打印    »显示摘要«
    摘要: 页面设置 public sub mnufilepagesetup_click() cellweb1.printpagesetup end sub 打印预览 public sub mnufileprintpreview_click() cellweb1.printpreview true, cellweb1.getcursheet end sub 打印 public sub mnufil......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE