Copied to clipboard

Flag this post as spam?

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


  • NDDT 68 posts 240 karma points c-trib
    Jan 25, 2016 @ 14:43
    NDDT
    0

    Create Media

    Is there another way to create Media-Items except handing a FileStream to the MediaService?

            FileStream tmpFile = System.IO.File.Open(path, FileMode.Open);
            IMedia m = Services.MediaService.CreateMedia("Name", -1, "Image");
            m.SetValue("umbracoFile", "Name", tmpFile);
            Services.MediaService.Save(m);
    

    I already have the file and it seems like a lot of trouble and terribly ineffective to copy it twice. I would prefere to put it manually in the media-folder.

  • Alex Skrypnyk 6182 posts 24284 karma points MVP 8x admin c-trib
    Jan 25, 2016 @ 18:21
    Alex Skrypnyk
    0

    Hi NDDT,

    Can you describe where do you get file ? All stages of media creation ?

    Thanks

  • 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