搜索引擎 软件注册码 电脑知识 软件运用技巧 QQ宝典 网站开发 网页制作 图形图像
数据库类 程序设计 电脑硬件 网络技术 免费留言簿 索尼爱立信 免费邮箱
游戏攻略 游戏秘技 魔兽私服技术 网游专区 免费主页空间
您的位置:首页-> 资讯中心-> 电脑资讯-> 网站开发-> ASP编程

ASP编程

ASP编程
ASP.NET编程
PHP编程
JSP编程
XML编程
数据库

本类阅读TOP10

·如何利用ASP把图片上传到数据库
·访问数据库(6)
·asp中常用的文件处理函数
·ASP SCRIPT: 计数器(使用GrapShot组件)
·ADO数据访问一点通
·显示以OLE对象存储图片的方法
·实用篇:用asp实现QQ在线查询
·关于ASPNET在IIS中的经验总结
·使用ASP读出文本文件并显示
·ASP中一个字符串处理类加强版(VBScript)

 
精品推荐

asp中常用的文件处理函数

作者:未知 来源:未知 加入时间:2007-6-11 点击量:48

 
asp 中处理文件上传以及删除时常用的自定义函数:

  <%
  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  '所有自定义的VBS函数
  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  function DeleteFile(Filename) '删除文件
  if Filename<>"" then
  Set fso = server.CreateObject("Scripting.FileSystemObject")
  if fso.FileExists(Filename) then
  fso.DeleteFile Filename
  end if
  set fso = nothing
  end if
  end function
  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  function CreateDIR(byval LocalPath) '建立目录的程序,如果有多级目录,则一级一级的创建
  on error resume next
  LocalPath = replace(LocalPath,"\","/")
  set FileObject = server.createobject("Scripting.FileSystemObject")
  patharr = split(LocalPath,"/")
  path_level = ubound(patharr)
  for i = 0 to path_level
  if i=0 then pathtmp=patharr(0) & "/" else pathtmp = pathtmp & patharr(i) & "/"
  cpath = left(pathtmp,len(pathtmp)-1)
  if not FileObject.FolderExists(cpath) then FileObject.CreateFolder cpath
  next
  set FileObject = nothing
  if err.number<>0 then
  CreateDIR = false
  err.Clear
  else
  CreateDIR = true
  end if
  end function
 

 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  function SaveRandFileName(byval szFilename) '根据原文件名生成新的随机文件名
  randomize
  'ranNum=int(90000*rnd)+10000
  'if month(now)<10 then c_month="0" & month(now) else c_month=month(now)
  'if day(now)<10 then c_day="0" & day(now) else c_day=day(now)
  'if hour(now)<10 then c_hour="0" & hour(now) else c_hour=hour(now)
  'if minute(now)<10 then c_minute="0" & minute(now) else c_minute=minute(now)
  'if second(now)<10 then c_second="0" & second(now) else c_second=minute(now)
  fileExt_a=split(szFilename,".")
  fileExt=lcase(fileExt_a(ubound(fileExt_a)))

  SaveRandFileName=replace(replace(replace(now,":",""),"-","")," ","")&int(10*rnd)&"."&fileExt   
  'GenerateRandomFileName = year(now)&c_month&c_day&c_hour&c_minute&c_second&"_"&ranNum&"."&fileExt
  end function
  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
   function jaron_replacer(strContent,start_string,end_string,replace_string)
  'CMS替换函数:源字符串,前部分,后部分,替换成的字符
  '返回被替换后的字符串
  jaron_replacer = replace(strContent,mid(strContent,instr(strContent,start_string),instr(strContent,end_string)+len(end_string)-1),replace_string)
  end function
  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  function replaceplus(strContent,start_string,end_string,replace_string)
  '文档中,将所有开始,结束之间的所有字符删除
  on error resume next
  MARKCOUNTS = ubound(split(strContent,start_string))
  PRESTRING = strContent
  for i=0 to MARKCOUNTS
  STARTMARK=instr(1,PRESTRING,start_string,1)
  if STARTMARK=0 then exit for
  COMPMARK=instr(1,PRESTRING,end_string,1) + len(end_string)
  VerString=mid(PRESTRING,STARTMARK,COMPMARK - STARTMARK)
  PRESTRING = replace(PRESTRING,VerString,replace_string)
  next
  replaceplus = PRESTRING
  if err.number<>0 then err.Clear
  end function
  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  %>
  



相关文章
  • ShotGraph函数介绍FindInBinary
  • 显示以OLE对象存储图片的方法
  • Form域中用Post提交容量大的数据
  • 如何利用ASP把图片上传到数据库
  • 网页中用隐藏帧来实现三个应用
  • ADO数据访问一点通
  • ASP Chat Professional组件信息
  • 访问数据库(3)
  • ShotGraph普通的画图的原理
  • 用ASP生成二维饼图
  • 相关软件

  • 卡巴斯基(Kaspersky) 7.0
  • AspStudio V0.77
  • ASP代码加密器 V2.0.53 正式版
  • Kaspersky Internet Security 2006 V6.0.12.175 汉化补丁
  • Kaspersky Internet Security 2006 V6.0.15.222
  • Kaspersky Personal Security Suite V1.0.22
  • Kaspersky Anti-Virus(AVP) 每周病毒库(2005.10.28)
  • Kaspersky Anti-Virus(AVP) Personal V5.0.388 汉化补丁
  • ExcelEverywhere for ASP & ASP.NET V3.4.1
  • Aspose.Word V3.1.4.0