Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Daniil 10 posts 31 karma points
    Jan 12, 2012 @ 16:00

    Cancelling save for media

    Greetings, everyone.

    I have a need to be able to reject media saving. Actual scenario depends on media type and properties, but I got the following test case.

    I have created following binding in AppBase:

    public class AppBase: umbraco.BusinessLogic.ApplicationBase 
    public AppBase()
    Media.BeforeSave += (sender, e) => RejectMedia( sender, e );

    void RejectMedia(Media sender, SaveEventArgs e)
    e.Cancel = true;

    It actually hits the "e.Cancel = true;" statement but media is still saved and seen Media section and on the actual website.

    Did I miss some additional hooks?

    Working with umbraco v 4.7.1 (Assembly version: 1.0.4281.20201)

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jan 12, 2012 @ 17:06
    Jeroen Breuer

    I think you need to read this: You can't actually cancel it. I believe this will be changed in Umbraco 5.


  • Daniil 10 posts 31 karma points
    Jan 13, 2012 @ 07:24

    Jeroen, thanks. I'll be looking for some other way around.

Please Sign in or register to post replies

Write your reply to: