2012-07-11 81 views
0

我正在考虑最终从数据库中的图像切换到文件系统的方法。有一个问题困扰我,迟早我会准备删除实体,在这种情况下,我不再需要链接的图像。所以,为了简化,实体模型将只有一个字段varchar来跟踪文件系统上的图像路径。将图像路径存储在数据库中。我如何管理删除图像与实体一起

有什么想法?

一两件事,因为我移动到文件系统映像存储我很好奇,是按以下顺序是确定的,还是有更好的办法

1. administrator will upload image to the server using mvc form, browse -> upload btn 
2. Creating new entity with entering some data into web form and using javascript select images from the server and store it's filename into entityimagepath property 
3. On the client side browser will render <img src=imagepathfromdb ... /> 

感谢您的时间

回答