Copied to clipboard

Flag this post as spam?

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


  • Jesse Wijnakker 2 posts 72 karma points
    Apr 19, 2017 @ 11:36
    Jesse Wijnakker
    0

    Delete uploaded media, when entry is deleted

    I have a form with the functionality to upload files along with it. It is saved in the entry as string (reference to ~/media). Except when an entry is deleted, only the reference is deleted, not the actual file. Is there a way I can hook into the delete event?

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Apr 19, 2017 @ 18:12
    Alex Skrypnyk
    0

    Hi Jesse

    How did you save media? Can you share the code? What Umbraco version?

    If you want to delete Umbraco media item you have to use MediaService - https://our.umbraco.org/documentation/reference/management/services/mediaservice

    Thanks,

    Alex

  • Jesse Wijnakker 2 posts 72 karma points
    Apr 21, 2017 @ 14:27
    Jesse Wijnakker
    0

    Hi,

    Umbraco version 7.5.13

    It's default in Umbraco Forms I think. The form I created in backoffice has a 'File Upload' functionality. The files are saved in ~media/forms/*. The entry contains a reference (string) to that file.

    How do I hook into

    Umbraco.Forms.Data.Storage.RecordStorage public static event EventHandler

    What I want is when I delete an entry, the uploaded file within the entry, get's deleted from ~media/forms/ and if possible the filesystem?

  • Jhon Cristian Talita 3 posts 73 karma points
    Feb 06, 2023 @ 13:26
    Jhon Cristian Talita
    0

    Hi @jesse

    Did you manage to make this work?

Please Sign in or register to post replies

Write your reply to:

Draft