Copied to clipboard

Flag this post as spam?

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


  • Divyansh 1 post 71 karma points
    Oct 14, 2020 @ 15:45
    Divyansh
    0

    Umbraco 8 is creating an ID for source instead of UDI

    Hello everyone, I'm trying to store a file in the CMS backend via code but when I upload the file to media picker using code it creates the source as this image Image with error But if I upload the file using CMS backend to a media picker then it works fine and creates the source UDI as following which works fine:Image without error Does anyone know any solution to this, I need to get its URL, but if try to access it, it gives the following error ?Error Image

    My code flow is, that it receives the file in the controller, saves it in the media folder and then in the document type it selects the file from the media using the following line of code: IMedia media = Services.MediaService.CreateMedia(docName, 1878, Constants.Conventions.MediaTypes.File); media.SetValue(Services.ContentTypeBaseServices, "umbracoFile", docName, files[0]); Services.MediaService.Save(media); cs.SetValue("uploadedFile", Id);

Please Sign in or register to post replies

Write your reply to:

Draft