|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
asp是基于web的一种编程技术,可以说是cgi的一种。它可以完成以往cgi程序的所有功能,如计数器、留言簿、公告板、聊天室等等。函数asp中处置文件上传和删除经常用的自界说函数
<%
一切自界说的VBS函数
functionDeleteFile(Filename)删除文件
ifFilename""then
Setfso=server.CreateObject("Scripting.FileSystemObject")
iffso.FileExists(Filename)then
fso.DeleteFileFilename
endif
setfso=nothing
endif
endfunction
functionCreateDIR(byvalLocalPath)创建目次的程序,假如有多级目次,则一级一级的创立
onerrorresumenext
LocalPath=replace(LocalPath,"","/")
setFileObject=server.createobject("Scripting.FileSystemObject")
patharr=split(LocalPath,"/")
path_level=ubound(patharr)
fori=0topath_level
ifi=0thenpathtmp=patharr(0)&"/"elsepathtmp=pathtmp&patharr(i)&"/"
cpath=left(pathtmp,len(pathtmp)-1)
ifnotFileObject.FolderExists(cpath)thenFileObject.CreateFoldercpath
next
setFileObject=nothing
iferr.number0then
CreateDIR=false
err.Clear
else
CreateDIR=true
endif
endfunction
functionSaveRandFileName(byvalszFilename)依据原文件名天生新的随机文件名
randomize
ranNum=int(90000*rnd)+10000
ifmonth(now)<10thenc_month="0"&month(now)elsec_month=month(now)
ifday(now)<10thenc_day="0"&day(now)elsec_day=day(now)
ifhour(now)<10thenc_hour="0"&hour(now)elsec_hour=hour(now)
ifminute(now)<10thenc_minute="0"&minute(now)elsec_minute=minute(now)
ifsecond(now)<10thenc_second="0"&second(now)elsec_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
endfunction
functionjaron_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)
endfunction
functionreplaceplus(strContent,start_string,end_string,replace_string)
文档中,将一切入手下手,停止之间的一切字符删除
onerrorresumenext
MARKCOUNTS=ubound(split(strContent,start_string))
PRESTRING=strContent
fori=0toMARKCOUNTS
STARTMARK=instr(1,PRESTRING,start_string,1)
ifSTARTMARK=0thenexitfor
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
iferr.number0thenerr.Clear
endfunction
%>
</p>国内有些大的CRM厂商的ASP就写得不错.无论是概念还是它里面用JAVASCRIPT的能力.并不是说现在的程序员用了ASP.NET来写程序就可以说自己高档了 |
|