8 Replies Latest reply on Aug 13, 2008 12:53 PM by Dan Bracuk

    Confirm File was downloaded and by whom?

    newportri Level 1
      Greetings

      I use cffile for an administrator to upload documents (PDF) to a repository directory. The name of the file is captured to the DB when uploaded.

      I need to confirm if/when an end user has downloaded the document, and any information I can capture (IP address, etc.?) using a yes/no flag field and a field to store IP address? The user's info is already a record in the DB, and their session variable is available at log-in.

      Thanks in advance

      newportri
        • 1. Re: Confirm File was downloaded and by whom?
          Dan Bracuk Level 5
          What's the part you are having difficulty with?
          • 2. Re: Confirm File was downloaded and by whom?
            newportri Level 1
            Dan:

            Thanks for your continued help!

            I don't know how I would go about confirming that the user actually surfaced the PDF to read it or print it. They could log into the system but not necessarily download documents- I need to have a record that confirms which documents they actually accessed.

            Thanks again-


            newportri
            • 3. Re: Confirm File was downloaded and by whom?
              Dan Bracuk Level 5
              You have to know how your site works. Specifically, you have to know the available methods of downloading documents.
              • 4. Re: Confirm File was downloaded and by whom?
                newportri Level 1
                Dan:

                The administrator uploads all the documents to a repository. The name of the document (whatever.pdf) is sent to the DB in a field named "FileContents" along with all the information about it, creating a record.

                Later, a user logs on and can now see a link to the document - something like

                <cfquery name="surface" datasource="#Request.BaseDSN#">
                SELECT new_bid_ID, FileContents
                FROM Bid
                WHERE new_bid_ID = 388
                </cfquery>

                <cfoutput query="surface"><a href="bids/documents/#FileContents#" target="_blank">Click Here to see this document</a></cfoutput>

                Is there any way to confirm that a logged-in user hit the link?

                Thanks again

                newortri
                • 5. Re: Confirm File was downloaded and by whom?
                  Dan Bracuk Level 5
                  The answer is in the anchor tag. Instead of going straight to the document, go to a cf page that allows you to collect your data before showing the pdf to the user.
                  • 6. Re: Confirm File was downloaded and by whom?
                    newportri Level 1
                    Dan:

                    Sorry to ask an assuredly simple question, but would the page simply carry out some processing then cflocation or would the user need to take additional action?

                    There is a session variable "Session.user_id" floating around- So it would need to be an update action- updating a yes/no field like:

                    UPDATE ****
                    SET didthedocgetopened = yes
                    WHERE Session.user_id = #Session.user_id#

                    ?

                    Thanks......
                    • 7. Re: Confirm File was downloaded and by whom?
                      Level 7
                      newportri wrote:
                      > Dan:
                      >
                      > Sorry to ask an assuredly simple question, but would the page simply carry out
                      > some processing then cflocation or would the user need to take additional
                      > action?
                      >

                      It could, but the usual solution is to use the <cfcontent...> tag to
                      deliver the desired content, the PDF document in your example, after all
                      desired logging and other processing.

                      It also allows for the PDF documents to not be in a web accessible
                      directory so that intelligent users can not by pass your security and
                      logging to directly access the document with a browser.
                      • 8. Re: Confirm File was downloaded and by whom?
                        Dan Bracuk Level 5
                        quote:

                        Originally posted by: newportri
                        Dan:

                        Sorry to ask an assuredly simple question, but would the page simply carry out some processing then cflocation or would the user need to take additional action?

                        There is a session variable "Session.user_id" floating around- So it would need to be an update action- updating a yes/no field like:

                        UPDATE ****
                        SET didthedocgetopened = yes
                        WHERE Session.user_id = #Session.user_id#

                        ?

                        Thanks......

                        Ian answered the first part.

                        For logging, I would be adding records, not updating them. That enables you to not only see who accessed the file, but how often.