Solved

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

Posted on 2012-12-31
2
1,545 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
ID: 38732284
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
ID: 38732289
<%
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 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

18 Experts available now in Live!

Get 1:1 Help Now