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
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:
Does anyone know any solution to this, I need to get its URL, but if try to access it, it gives the following error ?
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);
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
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:
Does anyone know any solution to this, I need to get its URL, but if try to access it, it gives the following error ?
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);
is working on a reply...
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.