Skip to main content
gokul1242
Inspiring
May 15, 2013
Question

help with cfmail url link

  • May 15, 2013
  • 3 replies
  • 1303 views

hi

my mail code is below:

<CFSET Path1 = "#APPLICATION.ROOTPATH#/index.cfm?fuseaction=customerReport&isemailPopUP=Y&fileName=#trim(txt_fileName)#">

<cfmail

    to=""

    from=""

    subject="">

Please note that the following file has been posted '#trim(txt_fileName)#'.

Direct Link to File: <#Path1#>

</cfmail>

Eg of the mail received

s

body: 

body:  Dear

body: 

body: 

body:  Please note that the following file has been posted '1  ColdFusion Coding Standards.docx'.

body: 

body: 

body:  : 

body:  Direct Link to File: <http://website.com/sales/index.cfm?fuseaction=customerReport&isemailPopUP=Y&fileName=1  ColdFusion Coding Standards.docx>

body:  

body: 

body: 

Now the problem is when the user clicks on the hyperlink to download the file ,special characters link _ (underscore) or some unicode characters are inserted in the file name between 1 and Coldfusion. because two empty spaces are  there in the file name .so the file is not downloaded..

how to resolve this issue

    This topic has been closed for replies.

    3 replies

    Participating Frequently
    May 15, 2013

    You need to use URLEncodedFormat() to turn those spaces into %20 (and fix other special characters). 

    http://livedocs.adobe.com/coldfusion/8/functions_t-z_10.html

    e.g.

    <a href="#URLEncodedFormat(Path1)#">your link</a>

    gokul1242
    gokul1242Author
    Inspiring
    May 15, 2013

    i am sure how to use  URLEncodedFormat() in my case.can you guide me where to use that function

    Participating Frequently
    May 15, 2013

    well using your exact example, simply wrap the function around your Path1 variable:

    Direct Link to File: <#URLEncodedFormat(Path1)#>