Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

How can i resize Images befor upload it With AJAXFileUpload ?

$
0
0

Hi all,

i hope that any one can help me with an example to learn me how can i do it - i just want to resize images befor upload it to server i use AJAXFileUpload Not AsyncFileUpload

This is my code to save images name in database and save images to server folder

protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
        {
            string Old_file_name = e.FileName;
            string new_file_name = DateTime.Now.ToString("d.M.yyyy h-mm tt" + "__") + e.FileName;
            string db_name = string.Empty;

            var full_path = Server.MapPath((String.Format("~/Images/pt_img/{0}/{1}", Session["pt_id"], Old_file_name)));
            var full_path_exits = Server.MapPath((String.Format("~/Images/pt_img/{0}/{1}", Session["pt_id"], new_file_name)));
            if (File.Exists(full_path))
            {
                db_name = new_file_name;
                AjaxFileUpload1.SaveAs(full_path_exits);
            }
            else
            {
                db_name = Old_file_name;
                AjaxFileUpload1.SaveAs(full_path);
            }

            Myfun.FireStoredProcedure("add_pt_img", new SqlParameter("@pt_id", Session["pt_id"].ToString()),
                                       new SqlParameter("img_name", db_name));
        }
    }

so please how can i dot it ?


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>