I am new to MVC and pretty new to web sites development. I have a dilemma how to manage uploaded images.
I have a data layer that uses entity framework in order to store data. In my controller constructor I give the IItemRepository and an IFileRepository implementations.
public ItemsController(IItemManager itemRepository, IFilesRepository fileRepository)
Mow I store the files in db (filename, mime type, relative server path) and the actual file is stored on the disk. In the controller I do the sync between the database and the folder. Is that the right approach? It seems to me that it is not. I am thinking of moving the IFileRepository into the IItemManager implementation.
Another problem is that for every controller that require files I have to implement the same sync between db and folder structure.
What do you think of storing files in the db?
How did you solved this problem?