string url;
if (this.FileUpload1.HasFile)
{
string savePath = Server.MapPath("images/banner/");
string fileName = this.FileUpload1.FileName;
string extension = Path.GetExtension(fileName);
if (extension != ".jpg" && extension != ".png" && extension != ".gif")
{
Response.Write("<script>alert('图片格式必须为.jpg、.png或.gif格式!');</script>");
return;
}
this.FileUpload1.SaveAs(savePath + "/" + fileName);
url = fileName;
}