I have built a simple ASP.NET MVC5 project that acts as a classifieds application for my college's students. I got everything figured out and implemented except for the images. I am struggling to find the best approach to store the images.
I came up with the following structure:
Ad
represents the advertisement modeladImage
represents an image(s) for an ad.AdImage
has a foreign Keypublic int AdId { get; set; }
and thenpublic virtual Ad TheAdvertisement { get; set; }
Considerations:
- I am using bootstrap
- I will not consider support older IE browsers
- I have to resize the images prior to save
- I will be saving the images on the file system and then store their urls back into my database.
I think I know how to upload then store multiple images. I am struggling with how to implement size-limitation validation to my controller and whether it is something I should consider to implement in my project. What is the best approach when dealing with images in classified website?