Skip to main content
Inspiring
August 14, 2008
Answered

PDF extension changed to DOC

  • August 14, 2008
  • 2 replies
  • 364 views
I'm using Verity and ColdFusion 8. I'm displaying the hyperlink of a pdf, but when it displays, it shows as a doc file. It still opens the pdf, but I would like to show the correct extension. Here's my code:

<!--- HREF to file is produced using either FILE protocol
or HTTP, depending on whether this is a web document.
so, we'll look at the file ext to determine if it's
a web doc or not --->
<cfset FileName=GetFileFromPath(Key)>
<cfset Ext=ListLast(FileName, ".")>
<!--- Display title if there is one, else name --->
<cfif Trim(Title) IS "">
<cfset display=GetFileFromPath(Key)>
<cfelse>
<cfset display=title>
</cfif>
<!--- Now display it --->
Key=#Key# <br>
display=#display# <br>
<a href="#url#">#display#</a> (#score#)

And here's what it returns. Out of about 300 pdfs listed, it only displays 3 as a pdf, all others are showing as a doc file.

Key=C:\ColdFusion8\wwwroot\Decisions07\Corporation\0718719 & 0719549.pdf
display=Microsoft Word - 18719 & 19549.doc
Microsoft Word - 18719 & 19549.doc (1.0000)
    This topic has been closed for replies.
    Correct answer tgoold
    I think I figured it out. display was being set to title. But I don't know how title got set to that Microsoft title. Weird. Anyway, I'm happy for now. Thanks.

    2 replies

    tgooldAuthor
    Inspiring
    August 14, 2008
    title = Microsoft Word - 18719 & 19549.doc

    I don't know why but it's also adding "Microsoft Word - " to the title. The real name of the pdf file is 18719 & 19549.pdf.

    Thanks.
    tgooldAuthorCorrect answer
    Inspiring
    August 14, 2008
    I think I figured it out. display was being set to title. But I don't know how title got set to that Microsoft title. Weird. Anyway, I'm happy for now. Thanks.
    Inspiring
    August 14, 2008
    What is the value of the title variable?