Skip to main content
Participant
April 13, 2021
Question

hyperlink inside Exel to file on web server

  • April 13, 2021
  • 1 reply
  • 294 views

I am trying to get the link inside my excel to open a file on my CF folder. The Excel file is in the same folder.

For the sake of explaining this is how the folders and files are structured:

I have 3 folders A, B, and C.

In folder A I have PDF_A1.pdf, PDF_A2.pdf and an excel file EXCEL_A.xlsx. The Excel file has 2 links to the 2 PDF files as described. Folder B and C are also similarly structured.

I use cfdirectory and navigating in and out of each folders and able to open the PDF files - no issue.

The problem is when I clicked to open the Excel file which opens fine, the link to the PDF points to my local temporary folder. But I wanted it to point the PDF file inside folder A

Thank you.

    This topic has been closed for replies.

    1 reply

    George____
    Inspiring
    April 14, 2021

    When you say that you "clicked to open the excel file" I assume you mean you're downloading the excel file in your web browser.    When you do that a copy is pulled from the server and placed on your computer's temporary folder.    Since you're using relative paths, excel is correctly showing you that the link points to your temporary folder, because that's where the copy of the excel file has been downloaded to.

     

    You'll need to use absolute paths instead.  If the excel file is at

    http://www.mywebsite.com/folderA/EXCEL_A.xlsx

    the link to the first PDF would be

    http://www.mywebsite.com/folderA/PDF_A1.pdf 

     

    BKBK
    Community Expert
    Community Expert
    April 16, 2021

    ColdFusion uses the local temporary folder as a default. For example, when you supply just the file name, and no value for the folder. 

    Use George's suggestion to create a link for users outside the server. For internal use, the full link will be something like file:///C:\ absolute\path\to\folderA\PDF_A1.pdf.