简体   繁体   中英

Multiple Image upload of single object ASP.NET MVC

I am doing student college registration project. When student fills out admission form online he has to upload his previous transcripts in jpg, pdf , png.

i want that when latter admin will open that particular student details page, admin should view all this particular student details and the image of multiple uploaded files in the browser.

following is my viewModel class

public class ViewModel
{
    public int StudentID { get; set; }        //PK
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public DateTime DateOfBirth { get; set; }
    public string Address { get; set; }
    public double PhoneNumber { get; set; }
    public string Email { get; set; }
    public DateTime AppliedDate { get; set; }
    public byte[] Picture { get; set; }
    public int AppliedID { get; set; }      
    public int CourseID { get; set; }       
}

I'm not sure if I fully understand your question but it sounds like you need to change the data structure of the uploaded files in your student model. If you're having trouble with passing a collection in a model to a view, you need to iterate over each of them. For instance:

Student:

public IEnumerable<string> UploadedFile;

View:

@foreach (var file in Model.UploadedFiles)
{
    // display
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM