protected void btnProductMasterUploadImg_OnClick(object sender, EventArgs e) { if (FileUploadProductMasterImg.PostedFiles != null) { CustomProfile profile = CustomProfile.GetProfile(); iProductMasterClient productClient = new iProductMasterClient(); string uploadfilepath = HttpRuntime.AppDomainAppPath; foreach (PostedFileInfo info in FileUploadProductMasterImg.PostedFiles) { string type = info.ContentType.Replace("image/", "").Replace("application/", ""); //type = type.Replace("application/", ""); string gridDisplayPath = "TempImg\\" + Session.SessionID.ToString() + DateTime.Now.Ticks.ToString() + "." + type; string SaveAsPath = uploadfilepath + "\\" + gridDisplayPath; //SaveAsPath = SaveAsPath.Replace('\\', '/'); if (!(Directory.Exists(uploadfilepath + "/TempImg"))) { Directory.CreateDirectory(uploadfilepath + "/TempImg"); } info.SaveAs(SaveAsPath); tImage UploadedImage = new tImage(); UploadedImage.ObjectName = "Product"; UploadedImage.ReferenceID = Convert.ToInt32(hdnprodID.Value); UploadedImage.ImageName = info.FileName; UploadedImage.ImgeTitle = txtImageTitle.Text; UploadedImage.ImageDesc = txtImageDescription.Text; UploadedImage.Path = gridDisplayPath; UploadedImage.Extension = type; //UploadedImage.Active = "Y"; if (rbtnYes.Checked == true) { UploadedImage.Active = "Y"; } else { UploadedImage.Active = "N"; } UploadedImage.CreatedBy = profile.Personal.UserID.ToString(); UploadedImage.CreationDate = DateTime.Now; UploadedImage.CompanyID = profile.Personal.CompanyID; productClient.AddTempProductImages(UploadedImage, Session.SessionID, profile.Personal.UserID.ToString(), profile.DBConnection._constr); } GVImages.DataSource = productClient.GetTempSaveProductImagesBySessionID(Session.SessionID, profile.Personal.UserID.ToString(), profile.DBConnection._constr); GVImages.DataBind(); txtImageDescription.Text = ""; txtImageTitle.Text = ""; } }