Where to store and how to remove images in a photo gallery?

kissem

New Member
I'm working on a photo gallery using ASP.NET.I'm storing user's images in a SQL database. I'm not sure how should displaying images look like.Let's say there is 1 picture per user, I was doing something like that:
  • get image from database
  • save it on server's disc as "file.jpg"
  • ASP:Image.uri = "file.jpg"
And that worked fine until I found out that If few users loads that page at the very same time, It might not work properly.Then I though changing "file.jpg" into some random string would help me:
  • get image from database
  • save it on server's disc as "ABCDUDHDJSAKFHADGJKHAKADFAD.jpg"
  • ASP:Image.uri = "ABCDUDHDJSAKFHADGJKHAKADFAD.jpg"
  • File.Delete("~/ABCDUDHDJSAKFHADGJKHAKADFAD.jpg");
But it wasnt possible to delete this file because it was still being used by a server.What would be the proper way to solve my problem? User in my photo gallery will eventually see 12 photos at the same time.
 
Back
Top