dear all
i have use ajax file upload and i want it not upload file if it exits
i try this in my code but i dont see any thing in lblmsg.text ? i want to prevent the upload and alert the client for that so pleasr how can i do that ?
var full_path = Server.MapPath((String.Format("~/Images/pt_img/{0}/{1}", Session["pt_id"], Path.GetFileName(e.FileName))));
if (!File.Exists(full_path))
{
AjaxFileUpload1.SaveAs(full_path);
var cn = new SqlConnection(cs);
var cm = new SqlCommand("add_pt_img", cn) { CommandType = CommandType.StoredProcedure };
cm.Parameters.Add("@pt_id", SqlDbType.Int).Value = Session["pt_id"].ToString();
// Save Image Name Only
cm.Parameters.Add("@img_name", SqlDbType.NVarChar, 150).Value = Path.GetFileName(e.FileName);
cn.Open();
cm.ExecuteScalar();
lblMsg.ForeColor = System.Drawing.Color.Yellow;
lblMsg.Text = "Patient Image Saved Successfully";
cn.Close();
}
else
{
lblMsg.Text = "File exists!!!";
return;
}