If Trim(rstCatItems.Fields("CatNotes") <> "") Then If fsoFile.FileExists(Left(Server.MapPath(Request.ServerVariables("SCRIPT_NAME")),Len(Server.MapPath(Request.ServerVariables("SCRIPT_NAME")))-15) + "images\" & Request.QueryString("CatCode") & ".jpg") = True Then %> <textarea rows="10" name="CatNotes" cols="34" style="font-family: MS Sans Serif"><%= rstCatItems.Fields("CatNotes") %></textarea> Code (markup): Can someone suggest what the "-15" number is if If UCase(Right(Trim(Request.ServerVariables("SCRIPT_NAME")), 10)) = "#.ASP" Or _ UCase(Right(Trim(Request.ServerVariables("SCRIPT_NAME")), 13)) = "#.ASP" Or _ UCase(Right(Trim(Request.ServerVariables("SCRIPT_NAME")), 13)) = "#.ASP" Or _ UCase(Right(Trim(Request.ServerVariables("SCRIPT_NAME")), 9)) = "#.ASP" Or _ UCase(Right(Trim(Request.ServerVariables("SCRIPT_NAME")), 15)) = "#.ASP" Or _ UCase(Right(Trim(Request.ServerVariables("SCRIPT_NAME")), 12)) = "#" Then Code (markup):
Len( Server.MapPath( Request.ServerVariables("SCRIPT_NAME") ) ) -15 First it gets the Script_Name, then it finds the real path of it (like "C:/inetpub/wwwroot/hello/") then the Len gets the Length of that string so it would be the length of C:/inetpub/wwwroot/hello/ - which is 26 (26 characters in that string) Then it minuses 26 - 15 which equals 11
I think I got the problem thanks for the pointer -15 was counting the filename characters, and deducting. However, I changed the file name and added a _2 to the file name, and as such -15 would change to -17, without this change the path to the right directory could not be established. So I need to change -15 to -17! Apparently, there is a better way, and I will post it later Thanks
Apparently, this does exaclty the same, but with no need to specify a num response.write (Server.MapPath(Request.ServerVariables("SCRIPT_NAME"))) response.write (left(Server.MapPath(Request.ServerVariables("SCRIPT_NAME")), InstrRev(Server.MapPath(Request.ServerVariables("SCRIPT_NAME")), "\"))) InstrRev the script name....