效果:
思路:
首先,獲取圖片物理地址,然後進行判斷將圖片保存到文件夾下,再將圖片的信息保存到數據庫。
數據庫:
ID (,) ImageName ( ImageType ( ImagePath ( )
代碼:
Page_Load( SQLString = ConfigurationManager.ConnectionStrings[ UploadButton_Click( (SqlConnection sqlcon = FullName = FileUpload1.PostedFile.FileName; FileInfo fi = name = fi.Name; type = fi.Extension; (type == || type == || type == || type == SavePath = Server.MapPath(); .FileUpload1.PostedFile.SaveAs(SavePath + + name); .Image1.Visible = .Image1.ImageUrl = + + name; sql = + name + + type + + name + SqlCommand cmd = .label1.Text = .label1.Text = }