欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

asp中将相对路径转换为绝对路径的函数代码

程序员文章站 2022-07-01 23:08:43
复制代码 代码如下:'================================================ ' 函数名:chkmappath ' 作 用:相对路...
复制代码 代码如下:

'================================================
' 函数名:chkmappath
' 作 用:相对路径转换为绝对路径
' 参 数:strpath ----原路径
' 返回值:绝对路径
'================================================
function chkmappath(byval strpath)
dim fullpath
strpath = replace(replace(trim(strpath), "/", "\"), "\\", "\")

if strpath = "" then strpath = "."
if instr(strpath,":\") = 0 then
fullpath = server.mappath(strpath)
else
strpath = replace(strpath,"..\","")
fullpath = trim(strpath)
if right(fullpath, 1) = "\" then
fullpath = left(fullpath, len(fullpath) - 1)
end if
end if
chkmappath = fullpath
end function