House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home / Groups / ColdFusion Newbie (CF-Newbie)

cfinput type File Convert filepath to URL address

Author:
Adam Parker
01/27/2010 10:54 AM

Hi Toni - I've encountered something similar.  I'm not sure if my approach is the best way, but I can describe what I dealt with.  I had to link to files users uploaded from an award nomination form.  All the files were in the same directory.  I knew I could reference them with cfdirectory so I did this:      <cfdirectory directory="#ExpandPath('/awards/chancellorsProfessors/nominationUploads/#fname#_#lname#/')#" recurse="true" name="nomineeFiles"> I then output all the files like this: <cfoutput query="nomineeFiles">   <ul>     <li><a href="#nomineeFiles.name#">#nomineeFiles.name#</a></li>   </ul> </cfoutput> This did output all the files in the directory, but with the way the link is referencing the file, it was a system path to the file on the server, not a typical hyperlink I ended up creating another variable called "filePath." <cfset filePath = "http://webaddress to directory/"> I then changed the hyperlink to: <li><a href="#filePath##nomineeFiles.name#">#nomineeFiles.name#</a></li> This worked for me.  Maybe something similar will work for you.


Search cf-newbie

February 08, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29