Copied to clipboard

Flag this post as spam?

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


  • Nathan Woulfe 447 posts 1665 karma points MVP 5x hq c-trib
    Jun 25, 2015 @ 06:20
    Nathan Woulfe
    0

    MediaService - copy?

    There's no copy method on the MediaService - how would I go about creating a copy of an existing media item, given the id of the parent of the new item?

  • René Pjengaard 118 posts 702 karma points c-trib
    Jun 25, 2015 @ 07:32
    René Pjengaard
    1

    Hi Nathan,

    i think you should create a new mediaitem with the CreateMedia method. If you load the item you would like to copy, you can use those properties to create the new item. Ex. parentId.

    https://our.umbraco.org/documentation/Reference/Management-v6/Services/MediaService

    Best regards René

  • Nathan Woulfe 447 posts 1665 karma points MVP 5x hq c-trib
    Jun 25, 2015 @ 08:37
    Nathan Woulfe
    0

    Hi Rene

    Will that actually create a copy of the media asset (ie the image or file)? I need the copy to have its own file, not just the same URL as the original, if that makes sense?

  • René Pjengaard 118 posts 702 karma points c-trib
    Jun 25, 2015 @ 08:43
    René Pjengaard
    0

    Hi Nathan,

    no it will not. I think you will have to use System.IO to do the copy (http://www.dotnetperls.com/file-copy).

    /René

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies