Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyperlinking Filenames in the table 1

Status
Not open for further replies.

Deadline

Programmer
Feb 28, 2001
367
US
Hi..
Hope you are doing great ....

I am posting after several 'successful failures' in my attempts to solve this problem..

I am expected to write an ASP file that'll fetch records from the database. One of the columns in the database is known as filename where I store files uploaded by the user.
Prior to storing the file, we rename it by adding the user's unique id to the file's orginal name.

For uploading ASPUpload from ASPUpload.com

Now we need to develop an ASP file which will display all the records with the filenames Hyperlinked.

How to do it ? Can you help me ?


Thank you...
RR

 
What is your particular challenge ? Does the value in that database field match the filename ? Do you just need a solution to display the filename in a hyperlink inside a table, or are you in need of extracting certain characters from the db field to come up with the correct file name ?

ToddWW
 
Yeah...

Thank you Todd.
The in the database the filenames are stored with their physical path.

Like this :-
Code:
ToddWW  C:\Upload\ToddWW_Happy1.PDF
ToddWW  C:\Upload\ToddWW_Compliments.DOC
RR      C:\Upload\RR_Cribbing.xls

The physical path is of the server's. And it is going to be constant. That is the folder where the uploaded files' names will be concatenated with the uSer ID and stored.
I need to display that C:\Upload as virtual path in the browser.

Like this:-

Code:
ToddWW
ToddWW_Happy1.PDF
Code:
ToddWW
ToddWW_Compliments.DOC
. ... . .

The blue indicates hyperlinks. Thank you...
RR

 
Here you go pal..
Code:
<%
dim pPath
dim vPath
pPath = &quot;C:\Upload\ToddWW_Happy1.PDF&quot;
vPath = Right(pPath,Len(pPath)-instrRev(pPath,&quot;\&quot;))
Response.Write &quot;<b>Physical:</b> &quot; & pPath & &quot;<br>&quot;
Response.Write &quot;<b>Virtual:</b> &quot; & vPath
%>
Go ahead and load that to see how it works. Basically, instrRev() gives the character position, starting from the end of the string, of the first \ in the string. We use that character position, subtract it from the string length and use that value in the Right() method. Viola.. returns everything past the last \

ToddWW
 
ToddWW, I would build a temple for you if I were rich enough..


Thanks a lot pal... Thank you...
RR

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top