if (FileTextAddsUpload.HasFile) ---Frist Time accepting true ..But Send time Saving the image ...It will displaying False { string FileName = Path.GetFileName(FileTextAddsUpload.PostedFile.FileName); string exten = Path.GetExtension(FileName); if (exten == ".png" || exten == ".PNG" || exten == ".jpg" || exten == ".JPG" || exten == ".jpeg" || exten == ".JPEG" || exten == ".gif" || exten == ".GIF") { FileTextAddsUpload.SaveAs(Server.MapPath("~/Images/" + FileName)); con.Open(); id++; SqlCommand cmd = new SqlCommand("InsertTextAdd_SP", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@TextAddImagePath", "~/Images/" + FileName); cmd.Parameters.AddWithValue("@MaxCharLength", txtEnterChar.Text); cmd.Parameters.AddWithValue("@Price", id); cmd.ExecuteNonQuery(); con.Close(); Imagetextadd.Visible = true; FileTextAddsUpload.ID = null; } ClearControls(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)