Last post Oct 04, 2011 06:33 AM by syedyaserahmed
Sep 29, 2011 01:41 AM|syedyaserahmed|LINK
how can i check if the file exist in the absolute path.
for example i have images in the absolute path from which i have to check if the image exits
I can do it from FILE.EXIST(path)
this method is not working for absolute path, even if the file exits its is showing the file doesnt exist.
is there any method to do this.
Sep 29, 2011 02:09 AM|bhupalb|LINK
File.Exists() will work for the absolute path in any whare
can give that path then i can tell u the problem
and you are checking in the web application
if (System.IO.File.Exists(@"D:\My Tasks\GoogleVis.txt"))
like this it is working fine for me
any doubut post me reply then we can try to solv
if it is helpful mark it as answer
Sep 29, 2011 02:44 AM|syedyaserahmed|LINK
my path would be "~/Images/photo/123.jpg"
I need to check this image in the location
Oct 04, 2011 06:33 AM|syedyaserahmed|LINK
you first need to get the path from server.mappath() method like in the below example
Dim strImageLocation As String = "~/Images/photo/" + strItemCode + ".jpg" Dim strActualImagePath As String = Server.MapPath(strImageLocation) Dim imgBtnImage As ImageButton = e.Item.FindControl("imgBtnImage") imgBtnImage.ImageUrl = strImageLocation Dim myfile As New FileInfo(strActualImagePath) If myfile.Exists() Then imgBtnImage.ImageUrl = strImageLocation Else imgBtnImage.ImageUrl = "~/Images/NoImage.png" End If