How to get mail when user update/upload file

adam

Administrator
Staff member
Dec 5, 2009
2,043
108
63
Hi,

This isn't possible via an admin setting at the moment. However you could amend the code to have it send an email on each upload. In:

/core/page/ajax/_update_file_options.ajax.php

At the end add this code:
Code:
$subject = 'New files uploaded';
    $replacements = array(
        'FILE_URLS' => implode("<br/>", $fullUrls),
        'SITE_NAME' => SITE_CONFIG_SITE_NAME,
        'WEB_ROOT' => WEB_ROOT,
        'PAGE_EXTENSION' => SITE_CONFIG_PAGE_EXTENSION,
        'UPDATE_COMPLETED_DATE_TIME' => date(SITE_CONFIG_DATE_TIME_FORMAT)
    );

    $defaultContent .= "New files uploaded, which completed uploading on [[[UPDATE_COMPLETED_DATE_TIME]]] are below:<br/><br/>";
    $defaultContent .= "[[[FILE_URLS]]]<br/><br/>";
    $defaultContent .= "Regards,<br/>";
    $defaultContent .= "[[[SITE_NAME]]] Admin";
    $htmlMsg = t('send_urls_by_email_to_admin_html_content', $defaultContent, $replacements);

    coreFunctions::sendHtmlEmail('[email protected]', $subject, $htmlMsg, SITE_CONFIG_DEFAULT_EMAIL_ADDRESS_FROM, strip_tags(str_replace("<br/>", "\n", $htmlMsg)));
Remove lines 57 & 59, they'll look like this:
Code:
if (strlen($fileToEmail)) {
...
}
Keep the line in the middle.

That should be it. I've not tested the above but if it doesn't work it should at least give you enough direction to do it.

Thanks,
Adam.