Solved

securing pdf files in an application

Posted on 2004-03-28
4
165 Views
Last Modified: 2013-12-24
Hi there.

Im trying to build an application that secures pdf files so that no one can upload them just by typing in the url.
They need to be in a secured directory and then accessed via a coldfusion page.
I have tried this but the only way I can seem to do this is via:

<cfheader
name="Content-Disposition"
value="attachment; filename=#filename#">
<cfcontent
type="application/unknown"
file="#filepath#">

Ive tried using application/pdf to display the page in the browser but all this seems to do is output the actual pdf code.
Any ideas?

Also thinking about storing the pdf's in a sql server database. Has anyone had any experience with this and also retrieving the pdf files?

Thanks Heaps
0
Comment
Question by:ipulse2
4 Comments
 

Accepted Solution

by:
ftvcs earned 250 total points
Comment Utility
I'd try something like this:

<cfif CGI.HTTP_REFERER eq"frompage.cfm">
<cfcontent type = "application/pdf"
  file = "c:\files\files1.pdf"> <!--- path not accesible from internet--->
</cfif>

If you have questions, don't hesitate to ask.

Tom
0
 
LVL 9

Assisted Solution

by:shooksm
shooksm earned 250 total points
Comment Utility
This works for me:

<cfheader name="content-disposition" value="inline;filename=#URLEncodedFormat(filename)#">
<cfcontent type="application/pdf" file="#filepath#" reset="yes">

Also, make sure your PDF files actually end with a PDF extension.

As far as saving them in the database, although it is possible.  It is not recommended.  The file system of your webserver is much faster at retrieving files than making a call do a database server.  Also, you can not output binary variables directly from Cold Fusion.  You have to save them as a local file using CFFILE then you use CFCONTENT to send them to the browser.  So, since you are sticking the file on the hard drive of the web server anyways, why not just keep it there in the first place.  Hope this helps.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now