[英]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.当学生在线填写录取表格时,他必须上传他以前的 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以下是我的 viewModel 类
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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.