Click to See Complete Forum and Search --> : Checking a File Exists


invisible kid
05-29-2006, 03:54 PM
Is there a method for checking that a file exists on the server?

I want to check that a file exists in a given folder, before trying to execute the file-reader on it, i.e:

Response.WriteFile(getFileName());

I need to embed this code in the front-end page, so the contents of the file are displayed in a particular place on the page if the file exists.

Thanks in advance,
IK

rajkiran
05-30-2006, 01:06 AM
Hi

using system.IO;

this namespace provide so few very good classes like

File.Exists(path)

also FileInfo Class

u can check them out

Thanks
http://www.lookforemails.com