Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1959
  • Last Modified:

Classic ASP, adding a check if file exists...

Linked with this thread

how do I add in a check to make sure the XML file exists? If it doesn't then just use a default image in the same way?

Thanks
0
Al4ddin2
Asked:
Al4ddin2
1 Solution
 
Al4ddin2Author Commented:
Ideally done here...

filename=Server.MapPath "/files/items.xml"

So if no path is set then it uses a default value?!

Thanks
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
<%
dim fs
set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists("c:\webroot\files\items.xml")=true then
  response.write("File c:\webroot\files\items.xml" exists!")
else
  response.write("File c:\webroot\files\items.xml" does not exist!")
end if
set fs=nothing
%>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now