Developer forum

Forum » Templates » Viewmodel list multiple files

Viewmodel list multiple files

Harald Brouwers
Reply

Hi,

I have a question, we have a code first item where we can selecte multiple images:

[File(Name = "Image",
            BaseDirectory = "/Images",
            Extension = "jpg,png,svg",
            MaxFilesToAdd = "6",
            Description = "",
            AllowFrontendUpload = false)]
public string SlideImages { get; set; }

But I cant figure out how to get a list of the filenames in the ViewModel template. I tried several options, but I keep getting null reference errors (yes I selected some images ;) ).

The most logical code would be:

Model.Item.GetFile("SlideImages")

But if I do something like a count Model.Item.GetFiles("Images").count(), I get the null reference error. How do I get a list of images in my template?

Greetings Harald


Replies

 
Harald Brouwers
Reply

Anyone?

O some extra information, if I add one file it works. But more than one file keeps giving null refrence errors.

 

You must be logged in to post in the forum