Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
System.IO.File.Exists
Message
From
25/05/2005 16:11:47
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01017546
Message ID:
01017636
Views:
22
Victor,

Thanks for the reply.

I tried the Server.MapPath() but got an error that says it was expecting a virtual path. It looks like Server.MapPath() requires a virtual path and returns the actual path. Unless I am missing something?

I know what the actual path is and what the virtual path is. I just want to verify that the image file exists before I fill in the image control.

Thanks,

Jerry



>Try something like this:
>
>
>////////////////////////////////
>string s = "\\\\myserver\\data\\images\\myimage.jpg"; //will not find this
>string lc_file1 = Server.MapPath(s) //Now it should find it
>string lc_file2 = "c:\\media\\images\\myimage.jpg"; //this will be found
>
>///This hits the else statement because it can't find the file.
>if (System.IO.File.Exists(lc_file1) == true)
>{
>///perform not found action
>}
>else
>{
>///peform found action
>}
>
>
>///This does find the file on the local drive.
>if (System.IO.File.Exists(lc_file2) == true)
>{
>///perform not found action
>}
>else
>{
>///peform found action
>}
>////////////////////////////////
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform