Solved

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

Posted on 2012-12-31
2
1,519 Views
Last Modified: 2012-12-31
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
Comment
Question by:Al4ddin2
2 Comments
 

Author Comment

by:Al4ddin2
Comment Utility
Ideally done here...

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

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

Thanks
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
Comment Utility
<%
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

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now