- <%
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- '所有自定义的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
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- %>
asp 中常用的文件处理函数
2019-11-01 12:52asp教程网 ASP教程
asp 中处理文件上传以及删除时常用的自定义函数
延伸 · 阅读
- 2021-10-20关于ASP网页无法打开的解决方案
- 2021-10-14让apache也支持asp环境的方法
- 2021-08-15asp取整数mod 有小数的就自动加1
- 2021-08-15asp与php中定时生成页面的思路与代码
- 2021-05-09IIS 7.5 asp Session超时时间设置方法
- 2021-03-05js实现的类似于asp数据字典的数据类型代码实例
精彩推荐
- ASP教程
asp 标记字符串中指定字符变色不区分大小写
今天遇到这种问题,单纯的使用replace函数不行,他会改变原有的字符串的大小写,在网上找到相关的代码,自己备份下...
- ASP教程
ASP.NET 数据源
数据源 一个 data sourse 控件与数据绑定的控件相互作用,并隐藏了复杂的数据的联编过程。这些是提供数据给 data bound 控件的工具,并且支持如插入,删除...
- ASP教程
JScript中遍历Request表单参数集合的方法
这篇文章主要介绍了JScript中遍历Request表单参数集合的方法,本文以遍历Request.QueryString集合为例给出了实现代码,需要的朋友可以参考下...
- ASP教程
asp 采集实战代码
最近实在是太流行采集了,本人是不喜欢采集的,但对采集的原理我却很有兴趣进行研究,拿到了网上采集常用函数,对其进行了一番研究,并实战,结果...
- ASP教程
asp Access数据备份,还原,压缩类代码
asp Access数据备份,还原,压缩类实现代码,大家可以参考下。...
- ASP教程
ASP常用函数:getpy()
ASP常用函数:getpy()...
- ASP教程
asp之基于adodb.stream的文件操作类
asp之基于adodb.stream的文件操作类...
- ASP教程
asp+javascript实现404页的处理转换
asp+javascript实现404页的处理转换...