I have a simple application.cfc file that I placed in the folder with the pdf documents. I need to record the useage to these documents for management. It will record the views when a user goes to a html page or cfm page but not the pdf. Is there a way to count these?
I'm including my hit counter code from the application.cfc file although it does work for web pages.
<cffunction name="OnRequestStart" returntype="boolean" output="true">
<cfquery name="addhit" datasource"#ds#">
insert into hits
(remote_address, page, date)
I've also tried moving this in the folder above thinking that may affect it but still the same results - no counts for the pdf documents. Any suggestions?
The pdf files are not being recorded with your application.cfc because pdf files are not handled by ColdFusion. As such they do not go through the ColdFusion request cycle (including application.cfc).
I guess you could create a ColdFusion template to serve your pdf files. Then the request would go through application.cfc. Not sure that's the direction I would take just to report usage stats. Are you using any web analytics tool with your site (WebTrends, Google, etc.)? Those tools can report on file accesses. Or you could analyze the web server's log files yourself to see how many times the pdf files are being downloaded.
Europe, Middle East and Africa