howard10
howard10

Reputation: 1851

Silverstripe File onAfterUpload method not called

I have an extension to File added with

Object::add_extension('File', 'MyFileDecorator');

I can confirm that the extension class is being created and that extending methods onBeforeWrite is working fine.

However, I am never seeing an extended onAfterUpload being called, despite the documentation claiming it should be called when the file has been uploaded.

I have tried using FileIFrameField, FileUploadField (from uploadify) and various data object manager classes, all to no avail.

Looking through FileIFrameField, it looks like there's no call to onAfterUpload so I guess my question is whether there's a field I could use that does call that method?

Upvotes: 0

Views: 281

Answers (1)

LiveSource
LiveSource

Reputation: 6429

You're right, doesn't look like it does get called. Uncle cheese's FileAttachmentField which is part of the kick assets module uses it. It's a nice file uploader But I believe it only works in the cms. Are you hoping to implement this in the cms or frontend?

https://github.com/unclecheese/KickAssets

Another option would be making use of the onAfterWrite method

Upvotes: 1

Related Questions