Copied to clipboard

Flag this post as spam?

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


  • Josip 110 posts 429 karma points
    Jul 16, 2019 @ 13:30
    Josip
    0

    How to programmatically delete file?

    Hi all,

    I cant find any example how to programmatically delete file (image). I think that i should use DeleteMediaFile(string filepath) but i dont know how to use it to delete for example news image.

    Any help is apriciated.

    Thanks

    Josip

  • Sibren 18 posts 129 karma points
    Jul 16, 2019 @ 13:36
    Sibren
    100

    You can use Umbraco.Web.Composing.Current.Services.MediaService.Delete(media-item) on a Media-item, given that you'd have the media-item. Otherwise, to get it by ID first: MediaService.GetById(id)

Please Sign in or register to post replies

Write your reply to:

Draft