|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
缺点:安全性不是太差了,还行,只要你充分利用系统自带的工具;唯一缺点就是执行效率慢,如何进行网站优化以后,效果会比较好。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
%>
asp,你就只能等着微软给你解决,它不乐意你就只好悲催。而且asp跑在windows服务器上,windows服务器跟linux比起来简直弱爆了! |
|