ASP 101 - Active Server Pages 101 - Web01
The Place ASP Developers Go!



Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash





Script Output:

Inline Code Version:

Checking to see if "file_exists.asp" exists: True

Checking to see if "file_doesnt.asp" exists: False

Function Version:

Checking to see if "file_exists.asp" exists: True

Checking to see if "file_doesnt.asp" exists: False


ASP HTML Download            FAQ

ASP.NET Version

I recently received an email from a visitor that wanted a quick and easy way to find out if a file exists on the server's file system. Not having a lot of information about the intended use, I wasn't sure if I should wrap it up in a function of not. As you could probably tell from the output above I decided to offer both versions.

The first implementation if useful if you're checking that the file exists before doing something else via the FileSystemObject (FSO). In that case you can use the same FSO used to check for the file's existance to do whatever else you need to do.

If, on the other hand, you're just checking if the file exists before passing control off to another function or checking that an XML file exists before loading it into an XML parser then the nice neat little function will probabably be the better choice.

Anyway, I've included both so you can choose whichever version makes sense for your situation.


Samples

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers