This topic is locked

Trigger emails on downloading

3/11/2010 12:44:08 PM
PHPRunner General questions
G
glazer author

I have a table with boxes containing file names. When the user clicks on one of the file names it automatically downloads that file to the user. That works fine. However, I would like to arrange that when a user clicks on the file name, I receive an email message telling me that a particular file has been downloaded and by whom. How can I do this?

Sergey Kornilov admin 3/11/2010

You can set 'View as' type of this field to 'File'. File will be downloaded via download.php page. You can add AfterAppInit or AfterTableInit event to find if current script name is download.php. If 'yes' you can write something to log file i.e. file name, username etc.
You can use the following code to find the current script name:

substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1)