|
-
Mar 4th, 2003, 01:49 PM
#1
Thread Starter
Addicted Member
IO.File.Exists?
I have a directory set up that people can put images of themselves in. My program checks to see if they have put a default photo in, and if they have not it displays a generic image. No matter what I put into the IO.Fle.Exists Line It always returns false. I have made the folder in question a Public Shared folder with everyone having read access, and the ASP Account has full access to it.
VB Code:
If IO.File.Exists("\\server\Photos\Emp\" & oDis.Manager.ExchangeName & "\" & "default.jpg") Then
imgPic.ImageUrl = "http://server/Photos/Emp/" & oDis.Manager.ExchangeName & "/default.jpg"
Else
imgPic.ImageUrl = "http://server/Photos/Emp/NA/default.jpg"
End If
-Daryl
"Two More Rolls of Duct tape, and the world is mine!"
VB.NET Guru
-
Mar 4th, 2003, 01:59 PM
#2
might be because oDis.Manager.ExchangeName isnt returning what you think it is, or it is returning nothing. Debug that.
-
Mar 4th, 2003, 02:05 PM
#3
Thread Starter
Addicted Member
I've walked though the routine, the command is correct.
-Daryl
"Two More Rolls of Duct tape, and the world is mine!"
VB.NET Guru
-
Mar 4th, 2003, 02:52 PM
#4
Thread Starter
Addicted Member
Suddenly an apple strikes me on the head.
I just realized that the Photos and the web site are on the same server so I just changed the command to:
VB Code:
If IO.File.Exists("D:\wwwroot\Photos\Emp\" & oDis.Manager.ExchangeName & "\" & "default.jpg") Then
imgPic.ImageUrl = "http://server/Photos/Emp/" & oDis.Manager.ExchangeName & "/default.jpg"
Else
imgPic.ImageUrl = "http://server/Photos/Emp/NA/default.jpg"
End If
Thanks for your help!
-Daryl
"Two More Rolls of Duct tape, and the world is mine!"
VB.NET Guru
-
Mar 4th, 2003, 10:35 PM
#5
PowerPoster
You can probably use something like Server.MapPath
I haven't used it myself yet, so I can't give you the exact syntax, but it will free you from hard coding paths.
-
Mar 5th, 2003, 12:19 PM
#6
Thread Starter
Addicted Member
I did try using Server.MapPath but was unsuccessful
-Daryl
"Two More Rolls of Duct tape, and the world is mine!"
VB.NET Guru
-
Mar 5th, 2003, 03:54 PM
#7
yay gay
Server.MapPath("myPicture.jpg") will return C:\inetpub\wwwroot\myPicture.jpg for example (if wwwroot is the folder)
\m/  \m/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|