文件是否存在? ASP经典版 [英] Does File Exist? ASP Classic

查看:104
本文介绍了文件是否存在? ASP经典版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是W3学校的一个简单示例:

Here is a simple example from 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

这给了我

但是,当我转到网址中的链接时,它会起作用:

Yet when I go to that link in the web address, it works:

那么,我想念或做错了什么?

So, what is it that I am missing or doing wrong?

推荐答案

感谢@Lankymart的帮助!

Thank you @Lankymart for the help!

strFilePath = Server.MapPath(".") & "\images\1.jpg"

解决它!

这篇关于文件是否存在? ASP经典版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆