protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) { string filePath = string.Empty; filePath = (Server.MapPath("~/Admin/") + Guid.NewGuid() + System.IO.Path.GetFileName(e.FileName)); AjaxFileUpload1.SaveAs(filePath); string strFile = filePath.Substring(filePath.LastIndexOf("\\")); string strFileName = strFile.Remove(0, 1); string strFilePath = "~/Admin/" + strFileName; SqlCommand cmd = new SqlCommand("Insert into tbl_ImageGallery (Image_Name,Imagepath,Category_Id) values (@Image_Name,@Imagepath,@Category_Id)", con); cmd.Parameters.AddWithValue("@Image_Name", strFileName); cmd.Parameters.AddWithValue("@Imagepath", strFilePath); cmd.Parameters.AddWithValue("@Category_Id",dropcategory.SelectedItem.Value); con.Open(); cmd.ExecuteNonQuery(); con.Close(); cmd.Dispose(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)