protected void upimage_Click(object sender, EventArgs e) { if (FileUpload1.HasFile == false) { msg("您还没有选择图片!"); return; } else { string filepath = FileUpload1.PostedFile.FileName; string fileEx = filepath.Substring(filepath.LastIndexOf(".") + 1); if (fileEx == "jpg" || fileEx == "bmp" || fileEx == "gif" || fileEx == "jpeg" || fileEx == "png") { sizela.Text = ""; string newfilename = "show_" + System.DateTime.Now.ToString("yyyyMMddhhmmssfff") + "." + fileEx; FileUpload1.PostedFile.SaveAs(Server.MapPath("~/show_imageurl/" + newfilename)); string savepath = "show_imageurl/" + newfilename; imageurl.Text = "../" + savepath; imagela.Text += "<img src=" + imageurl.Text + " style='" + "height: 180px; width: 120px" + "' />"; string siz = DateTime.Now.ToString("yyyyMMddhhmmssfff"); sizeidla.Text = siz; Model.proimage mym = new Model.proimage(); mym.imageid = _imageid.Text; mym.imageurl = savepath; mym.color = colorselect.SelectedItem.Text; mym.sizeid = sizeidla.Text; BLL.proimage bimage = new BLL.proimage(); int result = bimage.insert(mym); if (result > 0) { //Model.proimage mmym = new Model.proimage(); //mmym.sizeid = sizeidla.Text; //BLL.proimage bmy = new BLL.proimage(); //int select_id = bmy.selectid(mmym); //proimage_id.Text = Convert.ToString(select_id); msg("成功添加图片,接下来请选择所拥有图片"); } } else { msg("你上传文件格式不正确!!!"); return; } } }
protected void upimage_Click(object sender, EventArgs e) { if (FileUpload1.HasFile == false) { msg("您还没有选择图片!"); return; } else { string filepath = FileUpload1.PostedFile.FileName; string fileEx = filepath.Substring(filepath.LastIndexOf(".") + 1); if (fileEx == "jpg" || fileEx == "bmp" || fileEx == "gif" || fileEx == "jpeg" || fileEx == "png") { string newfilename = "show_" + System.DateTime.Now.ToString("yyyyMMddhhmmssfff") + "." + fileEx; FileUpload1.PostedFile.SaveAs(Server.MapPath("~/show_imageurl/" + newfilename)); string savepath = "show_imageurl/" + newfilename; Image1.ImageUrl = "~/" + savepath; Model.proimage mym = new Model.proimage(); mym.imageurl = savepath; mym.imageid = image_id.Text; mym.sizeid = u_sizeid.Text; BLL.proimage b_im = new BLL.proimage(); int result = b_im.upimage(mym); if (result > 0) { string path = "~/" + image_url.Text; if (File.Exists(Server.MapPath(path))) { File.Delete(Server.MapPath(path)); } msg("更新成功!!"); Response.Redirect("proimageselect.aspx?imageid=" + image_id.Text + ""); } } } }
protected void upimage_Click(object sender, EventArgs e) { if (FileUpload1.HasFile == false) { msg("您还没有选择图片!"); return; } else { string filepath = FileUpload1.PostedFile.FileName; string fileEx = filepath.Substring(filepath.LastIndexOf(".") + 1); if (fileEx == "jpg" || fileEx == "bmp" || fileEx == "gif" || fileEx == "jpeg" || fileEx == "png") { sizela.Text = ""; string newfilename = "show_" + System.DateTime.Now.ToString("yyyyMMddhhmmssfff") + "." + fileEx; FileUpload1.PostedFile.SaveAs(Server.MapPath("~/show_imageurl/" + newfilename)); string savepath = "show_imageurl/" + newfilename; imageurl.Text ="../"+ savepath; imagela.Text += "<img src=" + imageurl.Text + " style='" + "height: 180px; width: 120px" + "' />"; string siz = DateTime.Now.ToString("yyyyMMddhhmmssfff"); sizeidla.Text = siz; Model.proimage mym = new Model.proimage(); mym.imageid = _imageid.Text; mym.imageurl = savepath; mym.color = colorselect.SelectedItem.Text; mym.sizeid = sizeidla.Text; BLL.proimage bimage = new BLL.proimage(); int result = bimage.insert(mym); if (result > 0) { //Model.proimage mmym = new Model.proimage(); //mmym.sizeid = sizeidla.Text; //BLL.proimage bmy = new BLL.proimage(); //int select_id = bmy.selectid(mmym); //proimage_id.Text = Convert.ToString(select_id); msg("成功添加图片,接下来请选择所拥有图片"); } } else { msg("你上传文件格式不正确!!!"); return; } } }
protected void upimage_Click(object sender, EventArgs e) { if (FileUpload1.HasFile == false) { msg("您还没有选择图片!"); return; } else { string filepath = FileUpload1.PostedFile.FileName; string fileEx = filepath.Substring(filepath.LastIndexOf(".") + 1); if (fileEx == "jpg" || fileEx == "bmp" || fileEx == "gif" || fileEx == "jpeg" || fileEx == "png") { string newfilename = "show_" + System.DateTime.Now.ToString("yyyyMMddhhmmssfff") + "." + fileEx; FileUpload1.PostedFile.SaveAs(Server.MapPath("~/show_imageurl/" + newfilename)); string savepath = "show_imageurl/" + newfilename; Image1.ImageUrl = "~/" + savepath; Model.proimage mym = new Model.proimage(); mym.imageurl = savepath; mym.imageid = image_id.Text; mym.sizeid = u_sizeid.Text; BLL.proimage b_im = new BLL.proimage(); int result = b_im.upimage(mym); if (result > 0) { string path = "~/" + image_url.Text; if (File.Exists(Server.MapPath(path))) { File.Delete(Server.MapPath(path)); } msg("更新成功!!"); Response.Redirect("proimageselect.aspx?imageid="+image_id.Text+""); } } } }