How I can remove old items from list<> for the new run of application

In my page I upload files and then save them in the database. And I have 2 buttons; one for upload and another one for save.When I upload files I keep them in variable\[code\]public static List<upload> files = new List<upload>();\[/code\]And I have added below code to upload button click:\[code\]files.Add(new upload(FileName,contenttype,bytes));\[/code\]Now when press save button for saving to database \[code\]foreach (var file in files){ ProjDocAttach prjd = new ProjDocAttach(); prjd.ProjDocID = _Projectid; prjd.Data = http://stackoverflow.com/questions/15599182/file.FileBytes; prjd.FileName = file.Name; prjd.ContentType = file.Filetype; _DataContext.ProjDocAttaches.InsertOnSubmit(prjd); _DataContext.SubmitChanges();}\[/code\]When this is the first time I run I have no problem but if it is second or more all the old uploaded files in the previous runs will be added to database. Please help how I can solve this problem?
 
Back
Top