Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Physical Path to a file

    HI everyone,

    I am recently working on a company's project that performs basic search through the database and displays the relevant results. As per project requirement the search result should display the relative path of the document that it found. for e.g.

    if the user wants to search through the database for "test" .

    The asp page uses indexing service and finds through the database any file containing the word "test" once it finds the document, it displays the relative path to the file i.e.
    http://intra.test.arb.bon.omb.gov.on...ic/ceo/hearing scheduler table(2)-dec4-02.doc

    However, I want it to display absolute path to the document.
    d:\inetpub\wwwroot\blah...........\dec04-02.doc


    How would I make the query page search through the database and display the physical/relative path to each and every search result found.

    I am very new to asp ,I would really appreciate any help in this matter.

    Thanks

  • #2
    New to the CF scene
    Join Date
    May 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Cant' you just take the string that is returned in the search and do a find and replace?

    PM me if you need the code.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    I am the luckiest man in the world

  • #4
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by debo602
    Cant' you just take the string that is returned in the search and do a find and replace?

    PM me if you need the code.

    hi debo thx for the reply. I will give it a try.I will appreciate if you can send me the code.

    dew

  • #5
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow

    Server.MapPath(path)

    HI roelf,

    I have tried the above command but I believe this is best suitable when we know the name of the file .However,in my case its a database. So the name of the file is unknown and moreover, the search engine looks at several directories for e.g. d: ,P: , H: and finds the closest match to the search string.
    thx newaz ..


    dew

  • #6
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,062
    Thanks
    4
    Thanked 8 Times in 8 Posts
    1st declare a variable and put the file name into that like so
    myFile = objRS("filename")
    Then you can use the server.MapPath() function to find that file on your server like this Server.MapPath(myFile)

    So then instead of writing the path as an anchor
    <a href="<%=myFile%>"><%=myFile%></a>
    use this
    <%=Server.MapPath(myFile)%> or
    Write as an anchor but use the physical path
    <a href="<%=Server.MapPath(myFile)%>"><%=Server.MapPath(myFile)%></a>

  • #7
    New to the CF scene
    Join Date
    May 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The code would look something like this

    Code:
    strString = http://intra.test.arb.bon.omb.gov.lic/
    if Instr(strString, "http") > 0 then
    	strTest = replace(strString, "http://intra.test.arb.bon.omb.gov.lic/", "c:\test")
    	response.write strtest
    end if
    Here is a link the the replace function in the vbscript reference from microsoft.
    http://msdn.microsoft.com/library/de...fctreplace.asp

  • #8
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Quote Originally Posted by miranda
    1st declare a variable and put the file name into that like so
    myFile = objRS("filename")
    Then you can use the server.MapPath() function to find that file on your server like this Server.MapPath(myFile)
    Exactly, and technically you don't even need to use a variable, you can pass the recordset value directing into the MapPath function.
    OracleGuy


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •