I have a fileupload control that saves files to a folder in my solution, and also to the DB. When I retrieve the record from the DB I am unsure as to how I match up the DB record name to the same name in my folder?
This how I am saving and then when I retrieve how will I make things match up?
// Save to DB
string pathName = "uploads/" + Path.GetFileName(FileUpload1.PostedFile.FileName);
using (var db = new dbDataContext())
{
var insert = new ImageTbl()
{
imagePath = pathName
};
db.ImageTbls.InsertOnSubmit(insert);
db.SubmitChanges();
}
FileUpload1.SaveAs(Server.MapPath("~/uploads/" + FileUpload1.FileName));
I am just populating a grid view to experiment with:
private void LoadGrid()
{
using (var db = new dbDataContext())
{
...
Go to the complete details ...