Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-23-2005, 07:28 PM   PM User | #1
dew06
New to the CF scene

 
Join Date: Jun 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
dew06 is an unknown quantity at this point
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
dew06 is offline   Reply With Quote
Old 06-24-2005, 04:01 AM   PM User | #2
debo602
New to the CF scene

 
Join Date: May 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
debo602 is an unknown quantity at this point
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.
debo602 is offline   Reply With Quote
Old 06-24-2005, 09:35 AM   PM User | #3
Roelf
Senior Coder

 
Join Date: Jun 2002
Location: Zwolle, The Netherlands
Posts: 1,110
Thanks: 2
Thanked 28 Times in 28 Posts
Roelf is on a distinguished road
Server.MapPath(path)
Roelf is offline   Reply With Quote
Old 06-27-2005, 04:16 PM   PM User | #4
dew06
New to the CF scene

 
Join Date: Jun 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
dew06 is an unknown quantity at this point
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
dew06 is offline   Reply With Quote
Old 06-27-2005, 04:28 PM   PM User | #5
dew06
New to the CF scene

 
Join Date: Jun 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
dew06 is an unknown quantity at this point
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
dew06 is offline   Reply With Quote
Old 06-27-2005, 07:22 PM   PM User | #6
miranda
Senior Coder

 
Join Date: Dec 2002
Location: Arlington, Texas USA
Posts: 1,062
Thanks: 4
Thanked 8 Times in 8 Posts
miranda is an unknown quantity at this point
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>
miranda is offline   Reply With Quote
Old 07-28-2005, 04:39 PM   PM User | #7
debo602
New to the CF scene

 
Join Date: May 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
debo602 is an unknown quantity at this point
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
debo602 is offline   Reply With Quote
Old 07-28-2005, 05:41 PM   PM User | #8
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
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
oracleguy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:55 AM.


Advertisement
Log in to turn off these ads.