protected string ButtonUpload_UploadClick(object sender, WebControls.UploadButtonEventArgs e)
    {
        string message = "";

        try
        {
            if (Session["SSIdProUpload"] == null)
            {
                message = "Xin bạn hãy chọn sản phẩm muốn upload ảnh.";
                return(message);
            }
            else
            {
                string   strIdAndName            = Session["SSIdProUpload"].ToString();
                string[] arrvalue                = strIdAndName.Split(',');
                CvalidateImageForPost imgProcess = new CvalidateImageForPost();
                FileUpload            file       = e.FileUploadControl;
                string file_name = file.PostedFile.FileName;
                if (file_name.Length == 0)
                {
                    message = "Xin bạn hãy chọn file ảnh";
                    return(message);
                }
                else
                {
                    if (!imgProcess.TestTypeFile(file))
                    {
                        message = "File Không hợp lệ";
                        return(message);
                    }
                    else if (imgProcess.TestMaxSizeImage(file, 30720))
                    {
                        message = "Kích thước ảnh không quá 30 KB";
                        return(message);
                    }
                    else
                    {
                        string _path   = Server.MapPath("../image/img_pro/");
                        string namepro = "_";
                        if (arrvalue.Length == 3)
                        {
                            namepro = arrvalue[2];
                        }
                        string  strgetTime = new CGetDataCommon().GetStrMonthDayYearSecondMinuteHour();
                        string  nameNew    = "pro_" + arrvalue[0] + "_" + namepro + "_" + strgetTime + "." + imgProcess.GetExtension(file_name);
                        Boolean isUpload   = imgProcess.UploadFile(file, _path + nameNew);
                        if (isUpload)
                        {
                            ProductSystem ManagerPro = new ProductSystem();
                            Boolean       isUpdate   = ManagerPro.ProductUpdateImage(int.Parse(arrvalue[0]), nameNew);
                            if (isUpdate)
                            {
                                message = "";
                                //Xóa ảnh cũ đi:
                                imgProcess.DeleteFile(_path + arrvalue[1]);
                                return(message);
                            }
                            else
                            {
                                //Lỗi không thể cập nhật vào cơ sở dữ liệu. Xóa ảnh vừa upload lên đi.
                                imgProcess.DeleteFile(_path + nameNew);
                                message = "Lỗi kết nối SQL server. Không thể cập nhật được ảnh. Xin hãy thử lại";
                                return(message);
                            }
                        }
                        else
                        {
                            message = "Lỗi mạng hoặc không có quyền tạo file trong thư mục ảnh sản phẩm. Không thể Upload file ảnh. Xin bạn hãy thử lại";
                            return(message);
                        }
                    }
                }
            }
        }
        catch
        {
            message = "Có các lỗi sau đây: Không có quyền tạo file trong thư mục ảnh sản phẩm. Hoặc không cập nhật được vào CSDL. Hoặc ảnh bạn chọn không còn tồn tại. Xin bạn hãy thử lại";
        }
        return(message);
    }