Random random = new Random();
string logoKey;
string brandLogo;
//Generate random key.
logoKey = Convert.ToString(random.Next());
if (fuUploadLogo.FileName == "")
{
MessageBox(this, "Select the logo image");
fuUploadLogo.Focus();
return;
}
brandLogo = fuUploadLogo.FileName;
if (brandLogo.Trim().Length > 0)
{
brandLogo = "Coupon" + logoKey + brandLogo;
brandLogo = brandLogo.ToString().Replace(" ", ".");
}
if ((brandLogo.ToString() != "") && (fuUploadLogo.HasFile == true))
{
fuUploadLogo.SaveAs(Server.MapPath("../Common/BrandLogo/" + Convert.ToString(brandLogo)));
}
}
//Show message if file is not uploaded.
public void MessageBox(System.Web.UI.Page page, string Msg)
{
string MsgScript = "";
if (!(page.IsStartupScriptRegistered("MessageScript")))
page.RegisterStartupScript("MessageScript", MsgScript);
}
No comments:
Post a Comment