Copied to clipboard

Flag this post as spam?

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


  • Michael Beever 74 posts 155 karma points
    Aug 20, 2020 @ 10:33
    Michael Beever
    0

    Media Picker issue

    Hi,

    I am working on a media picker with multiple files.

    I am using the example from the Umbraco site.

    https://our.umbraco.com/Documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Media-Picker/index-v7

    But i am getting this error

    Exception Details: System.FormatException: String "[{"name":"Test Attachment"" is not a valid udi.
    
    Source Error:
    
    
    Line 93:                     
    Line 94:                     @{
    Line 95:                         var typedMultiMediaPicker = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("attachments");
    Line 96:                         foreach (var item in typedMultiMediaPicker)
    Line 97:                         {
    

    The code I am using is

                @{
                    var typedMultiMediaPicker = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("attachments");
                    foreach (var item in typedMultiMediaPicker)
                    {
                        <a href="@item.Url">Test</a>
                    }
                    }
    

    Any obvious issues?

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Aug 21, 2020 @ 20:35
    Alex Skrypnyk
    0

    Hi Michael

    Can you go to the Umbraco backoffice and republish the node you are trying to load on the page?

    Looks like some data is corrupted in "attachments" field

    Thanks, Alex

  • Michael Beever 74 posts 155 karma points
    Aug 24, 2020 @ 10:29
    Michael Beever
    0

    Hi new node added and still get this

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
    
    Source Error:
    
    
    Line 94:                     @{
    Line 95:                         var typedMultiMediaPicker = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("JobAttach");
    Line 96:                         foreach (var item in typedMultiMediaPicker)
    Line 97:                         {
    Line 98:                             <a href="@item.Url">Test</a>
    
Please Sign in or register to post replies

Write your reply to:

Draft