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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Hyperlinks to files listed in SQL output...

Status
Not open for further replies.

goheat

Technical User
Apr 12, 2002
5
US
I have a SQL database that stores a list of filenames (no directory name)from a specified directory, using xp_cmdshell dir. I have set up a job, that runs at specific intervals, to delete and update the database with the current files. Is there a way that I can use ColdFusion to output this data and add hyperlinks to the filenames so people can click & download/view? Can it assume the current directory as the virtual directory?

Any help would be appreciated!

Thanks,

John
 
That should be fairly easy to do -- just query the database for the list, then use a cfoutput to build your hyperlinks:

<cfquery name=&quot;qryGetFileNames&quot; datasource=&quot;foo&quot;>
Select filename from MyTable
</cfquery>

<cfoutput query=&quot;qryGetFileNames&quot;>
<a href=&quot;#filename#&quot;>#filename#</a><br>
</cfoutput>

This would assume of course that the directory your .cfm template is currently located would be the directory your files are. (You can always modify the path name in the href like

<a href=&quot;/download_dir/#filename#&quot;>#filename#</a>

Or something like that.
 
Thanks for the info, CFDude! I'll give this a shot. I really appreciate your help!

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top