Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Module to extend function onAfterUpload


Go to End


1158 Views

Avatar
Rudiger

Community Member, 8 Posts

17 July 2016 at 8:31am

Hi,

Very new to SilverStripe and doing a module is not making sense to me. I'd like to perform a task when a new file is uploaded to the file system. I've created a new folder and within that put the _config.php and code folder. I've added a class called Test.php with :

class Test extends File {
     function onAfterUpload( ) {
     	user_error("Test", E_USER_WARNING);
    }
}

I would think when I upload a file I'd get a log message but I don't. Instead of extending file I've also extended DataExtension but with no output either. Where am I going wrong?