using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
//5//1//a/s/px///
public partial class addImage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        DB db = new DB();
        int albumID = Convert.ToInt32(DropDownList1.SelectedValue);
        DateTime imageTime = DateTime.Now;
        string imageUrl = "image/" + FileUpload1.FileName;
        string imageType = FileUpload1.FileName.Split('.')[1];
        string imageName=FileUpload1 .FileName .Split ('.')[0];
        string imageDesc=TextBox1 .Text .ToString ();
        if(imageType .ToLower ()=="jpg"||imageType .ToLower ()=="gif"||imageType .ToLower ()=="png")
        {
            FileUpload1 .SaveAs (Server .MapPath (imageUrl ));
        }
        db .addimage (albumID ,imageName ,imageUrl ,imageTime ,imageDesc);
        Response .Write ("<script>alert('添加成功！');location.href='Default.aspx';</script> ");

    }
}
