• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFpdf and CFcontent shows filepath and filename in browser

Explorer ,
Feb 01, 2013 Feb 01, 2013

Copy link to clipboard

Copied

Thanks to all for past help on my CF questions...

I've developed an upload application for (logged in to secure environment) users that uploads a pdf outside of the root, moves and renames the file and then cfpdf protects the file with a password. Part of the upload process inserts variables in a SQL database such as Catagory, Subcatagory, FileName, etc. The cffile move puts the file inside the root where I have a security framework. No problem with this.

I have a cfm page populated (dynamically) with links to the pdf files. These links contain url handlers that pass the filepath and filename. When a user clicks a link, he is carried to an index.cfm that has the security framework and within this page I have cfpdf link to the pdf file (and sets a password) and cfcontent loading the pdf file in the browser. All of this works just fine, as it should.

However... Because cfpdf sets the filepath/filename source and destination and passes this on to the cfcontent tag -- the filepath and filename are shown in the browser address bar as well as naming the download file the same as the http address (albeit with underscores) if the user saves the file. Anyone with any savvy can figure out the actual filepath and filename and go directly to the file in their browser. They'd still have to type in a password to view the file but I'd rather not have this filepath exposed like this.

Without having to create a copy of the original and rename the file, is there a way to change what is shown in the browser address and in the download filename? At some point there may be many pdf files uploaded and stored on this site. I'd rather not have 2 copies of each file on the server - the original and one renamed...

I've googled and googled and can't find an answer anywhere on this. Thanks to anyone pointing me in the right direction here.

- e

Views

567

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Feb 02, 2013 Feb 02, 2013

Finally figured this out...

Since the file exists on the server, there's no need to use cfpdf and cfcontent to serve up the PDF.

When the PDF link is clicked, the user is directed to a page that has the security framework where there is a redirect to the PDF on the server. I have the PDF password protected. The PDF opens in the browser and, if saved, is saved with the file name only instead of the whole url+filename.

Learning to work with CF and PDFs through cfdocument and cfpdf lately has been som

...

Votes

Translate

Translate
Explorer ,
Feb 02, 2013 Feb 02, 2013

Copy link to clipboard

Copied

LATEST

Finally figured this out...

Since the file exists on the server, there's no need to use cfpdf and cfcontent to serve up the PDF.

When the PDF link is clicked, the user is directed to a page that has the security framework where there is a redirect to the PDF on the server. I have the PDF password protected. The PDF opens in the browser and, if saved, is saved with the file name only instead of the whole url+filename.

Learning to work with CF and PDFs through cfdocument and cfpdf lately has been somewhat frustratingly fun.(!) I guess it was overkill in trying to do the above when all I needed was a direct link to the file itself.

Hope this will help someone else...

- e

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation