One of my web pages allows the user to create a new record, and, at the same time, associate any number of images with that record. The way I am thinking of doing this is to upload each image to the server when the user click the 'upload' button in conjunction with a fileupload control. Then, when the user clicks the 'update' button for the entire record, I will create the record, then, using the id of the new record, add each image to the images table using the id of the record just added.
Oh, and I will be deleting all temp image files from the server each time the application starts. I figure I can get away doing it this way since adding images to a record will not be used very much, so there is little danger of filling up the server with temp images.
Is there a better way to do this? I'm fairly new to ASP.NET and SQLServer, so I'm completely open to any suggestions on how to improve this.