文件存在吗? ASP经典
Does File Exist? ASP Classic
这是一个来自 W3 Schools 的简单示例:
dim fs
strFilePath = "http://lanswinweb1/assembly/scrollingimages/images/" & Session("Num") & ".jpg"
'strFilePath = "P:\Assembly\Team Performance Boards\LDT Scrolling Monitor\" & Session("Num") & ".jpg"
set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists(strFilePath) then
Session("Num") = Session("Num") + 1
response.write("File: " & strFilePath & " exists!")
else
response.write("File: " & strFilePath & " does not exist!")
end if
set fs=nothing
这给了我:
然而,当我转到网址中的 link 时,它起作用了:
那么,我遗漏或做错了什么?
感谢@Lankymart 的帮助!
strFilePath = Server.MapPath(".") & "\images.jpg"
解决了!
这是一个来自 W3 Schools 的简单示例:
dim fs
strFilePath = "http://lanswinweb1/assembly/scrollingimages/images/" & Session("Num") & ".jpg"
'strFilePath = "P:\Assembly\Team Performance Boards\LDT Scrolling Monitor\" & Session("Num") & ".jpg"
set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists(strFilePath) then
Session("Num") = Session("Num") + 1
response.write("File: " & strFilePath & " exists!")
else
response.write("File: " & strFilePath & " does not exist!")
end if
set fs=nothing
这给了我:
然而,当我转到网址中的 link 时,它起作用了:
那么,我遗漏或做错了什么?
感谢@Lankymart 的帮助!
strFilePath = Server.MapPath(".") & "\images.jpg"
解决了!