protected void btnUpload_Click(object sender, EventArgs e) { ctl_newbuilding insert = new ctl_newbuilding(); String folderUser = Server.MapPath("~/uploadimages/thuvienanh/"); if (!Directory.Exists(folderUser)) { Directory.CreateDirectory(folderUser); } string filename; string ulr = "/uploadimages/thuvienanh/"; HttpFileCollection hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[i]; if (hpf.ContentLength > 0) { //string filename = Path.GetRandomFileName() + Path.GetExtension(FileUpload1.FileName); //filename = ulr + System.IO.Path.GetFileName(cls_ToAscii.ToAscii(hpf.FileName).ToLower()); filename = ulr + Path.GetRandomFileName() + Path.GetExtension(hpf.FileName); string path = HttpContext.Current.Server.MapPath("~/" + filename); hpf.SaveAs(path); VaryQualityLevel(System.Drawing.Image.FromStream(hpf.InputStream), path); insert.InsertImageOneProduct(filename); } } rpImageListing.DataSource = from i in db.tbCollectionImages select i; rpImageListing.DataBind(); foreach (RepeaterItem item in rpImageListing.Items) { HtmlGenericControl control = item.FindControl("divSub") as HtmlGenericControl; if (control != null) { //set the control value here. } } //divMes.InnerHtml = mes; //Session["re_id"] = null; cls_Alert.alert_Success(Page, "Đã lưu thành công", ""); loadData(); }