0

I am using CKFinder 2.6 for ASP.NET. The problem I'm trying to solve is that I need to do processing before/after a file is uploaded using the CKFinder. Is there a way to subscribe to beforeUpload or afterUpload events in CKFinder? I've looked in their documentation, but can't find anything suitable.

Thanks

Anna Tomanek
  • 2,219
  • 16
  • 23
palmej2
  • 73
  • 7

1 Answers1

6

I'm assuming you need solution for the server part of CKFinder.

There is no specific beforeUpload event. To handle things that happened before upload subscribe to CKFinderEvent.BeforeExecuteCommand and check CKFinderEventArgs field data[0] for "FileUpload" or "QuickUpload".

To subscribe to afterUpload event subscribe to CKFinderEvent.AfterFileUpload.

There are two example plugins that subscribe to CKFinderEvent.BeforeExecuteCommand and CKFinderEvent.AfterFileUpload events. These are ImageResize and Watermark respectively.

kfazi
  • 617
  • 1
  • 9
  • 21
  • Can the AfterFileUpload event be subscribed in the config.ascx file, or does it require modification of the source code (and re-compile)? Thanks – palmej2 Jan 20 '16 at 17:40
  • 1
    @palmej2: `config.ascx` is just for configuration and it doesn't have access to `CKFinderEvent` object. The best way to add event handlers is to implement you own plugin. [Here](http://docs.cksource.com/CKFinder_2.x/Developers_Guide/ASP.NET/Plugins/Writing_ASP.NET) is a documentation on how to do this. In the source code there are also 3 sample plugins: `FileEditor`, `ImageResize` and `Watermark` – kfazi Jan 20 '16 at 18:45