protected void LinkButton1_Click(object sender, EventArgs e) { ToolTable TT = new ToolTable(); TT.Cat = Convert.ToInt32(DropDownList1.SelectedValue); TT.ToolName = TextBox2.Text; TT.ThumbPic = "~/Dashboard/ThumbnailPic/" + FileUpload1.FileName; FileUpload1.SaveAs(Server.MapPath("~/Dashboard/ThumbnailPic/" + FileUpload1.FileName)); FileUpload2.SaveAs(Server.MapPath("~/Dashboard/ThumbnailPic/" + FileUpload2.FileName)); FileUpload3.SaveAs(Server.MapPath("~/Dashboard/ThumbnailPic/" + FileUpload3.FileName)); FileUpload4.SaveAs(Server.MapPath("~/Dashboard/ThumbnailPic/" + FileUpload4.FileName)); FileUpload5.SaveAs(Server.MapPath("~/Dashboard/ThumbnailPic/" + FileUpload5.FileName)); FileUpload6.SaveAs(Server.MapPath("~/Dashboard/ThumbnailPic/" + FileUpload5.FileName)); TT.Content1 = TextBox2.Text; TT.Pic1 = "/Dashboard/ThumbnailPic/" + FileUpload2.FileName; TT.Content2 = TextBox3.Text; TT.Pic2 = "/Dashboard/ThumbnailPic/" + FileUpload3.FileName; TT.Content3 = TextBox4.Text; TT.Pic3 = "/Dashboard/ThumbnailPic/" + FileUpload4.FileName; TT.Content4 = TextBox5.Text; TT.Pic4 = "/Dashboard/ThumbnailPic/" + FileUpload5.FileName; TT.MianContent = TextBox1.Text; TT.SourceCode = "/Dashboard/SourceCode/" + FileUpload6.FileName; dl.da.ToolTables.InsertOnSubmit(TT); dl.da.SubmitChanges(); Response.Write("<script>alert('Success')</script>"); TextBox1.Text = TextBox2.Text = TextBox3.Text = TextBox4.Text = TextBox5.Text = ""; }
protected void btnAddEvent_Click(object sender, EventArgs e) { if (FileUpload4.PostedFile != null && FileUpload4.PostedFile.FileName != "") { FileUpload4.SaveAs(Server.MapPath("Images/Churches/" + FileUpload4.FileName.ToString())); } }
protected void trigger_Click(object sender, EventArgs e) { var orgID = HttpContext.Current.Session["orgID"]; if (FileUpload2.PostedFile != null && FileUpload2.PostedFile.FileName != "") { var ext = FileUpload2.FileName.Split('.')[FileUpload2.FileName.Split('.').Length - 1]; FileUpload2.SaveAs(Server.MapPath("Images/Organizations/" + orgID + ".1." + ext)); } if (FileUpload3.PostedFile != null && FileUpload3.PostedFile.FileName != "") { var ext = FileUpload3.FileName.Split('.')[FileUpload3.FileName.Split('.').Length - 1]; FileUpload3.SaveAs(Server.MapPath("Images/Organizations/" + orgID + ".2." + ext)); } if (FileUpload4.PostedFile != null && FileUpload4.PostedFile.FileName != "") { var ext = FileUpload4.FileName.Split('.')[FileUpload4.FileName.Split('.').Length - 1]; FileUpload4.SaveAs(Server.MapPath("Images/Organizations/" + orgID + ".3." + ext)); } if (FileUpload5.PostedFile != null && FileUpload5.PostedFile.FileName != "") { var ext = FileUpload5.FileName.Split('.')[FileUpload5.FileName.Split('.').Length - 1]; FileUpload5.SaveAs(Server.MapPath("Images/Organizations/" + orgID + "." + ext)); } }
public void SaveData() { FileUpload1.SaveAs(Server.MapPath("~/Images/Poster/") + FileUpload1.FileName); FileUpload2.SaveAs(Server.MapPath("~/Images/FeaturePhoto/") + FileUpload2.FileName); FileUpload3.SaveAs(Server.MapPath("~/Images/FeaturePhoto/") + FileUpload3.FileName); FileUpload4.SaveAs(Server.MapPath("~/Images/FeaturePhoto/") + FileUpload4.FileName); FileUpload5.SaveAs(Server.MapPath("~/Images/FeaturePhoto/") + FileUpload5.FileName); FileUpload6.SaveAs(Server.MapPath("~/Images/FeaturePhoto/") + FileUpload6.FileName); string destiny = "~/Images/Poster/" + 10 + ".jpg"; File.Copy("~/Images/Poster/" + FileUpload1.FileName, destiny); File.Delete("~/Images/Poster/" + FileUpload1.FileName); int status = obj.InsertUser(txtMovieName.Text, txtCast.Text, txtPlot.Text, calReleaseDate.SelectedDate.ToString(), FileUpload1.FileName, FileUpload2.FileName, FileUpload3.FileName, FileUpload4.FileName, FileUpload5.FileName, FileUpload6.FileName, txtRoyal.Text, txtClassic.Text, txtExecutive.Text); if (status == 1) { lblMsg.Text = "Movie Added successfully"; txtMovieName.Text = ""; txtCast.Text = ""; txtPlot.Text = ""; txtClassic.Text = ""; txtExecutive.Text = ""; txtRoyal.Text = ""; } else { lblMsg.Text = "OOPS !!! Something went wrong...."; } }
protected void Butfac_Click(object sender, EventArgs e) { if (Textfac1.Text == "") { Labmsg.Text = "ENTER DATA...!"; Labmsg.ForeColor = System.Drawing.Color.DarkRed; } else { String constring = "Data Source=LAPTOP-T30095AD;Initial Catalog=managementsystem;Integrated Security=True"; SqlConnection sqlcon = new SqlConnection(constring); FileUpload1.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload1.FileName)); String link4 = "images" + Path.GetFileName(FileUpload1.FileName); FileUpload2.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload2.FileName)); String link5 = "images" + Path.GetFileName(FileUpload2.FileName); FileUpload3.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload3.FileName)); String link6 = "images" + Path.GetFileName(FileUpload3.FileName); FileUpload4.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload4.FileName)); String link7 = "images" + Path.GetFileName(FileUpload4.FileName); String query = "Insert into Faculty_Documents(facultyName,facultyId,profileimg,aadharcard,othercard1,othercard2) values('" + Textfac1.Text + "','" + Textfac2.Text + "','" + link4 + "','" + link5 + "','" + link6 + "','" + link7 + "')"; SqlCommand cmd = new SqlCommand(query, sqlcon); sqlcon.Open(); cmd.ExecuteNonQuery(); Labmsg.Text = "SAVED SUCCESSFULLY...!"; Labmsg.ForeColor = System.Drawing.Color.DarkGreen; sqlcon.Close(); Textfac1.Text = ""; Textfac2.Text = ""; } }
protected void Button9_Click(object sender, EventArgs e) { FileUpload1.SaveAs(Server.MapPath("~/img/") + FileUpload1.FileName); FileUpload2.SaveAs(Server.MapPath("~/img/") + FileUpload2.FileName); FileUpload3.SaveAs(Server.MapPath("~/img/") + FileUpload3.FileName); FileUpload4.SaveAs(Server.MapPath("~/img/") + FileUpload3.FileName); int inst = DsAdapter.Insert(txtiname.Text, txtdescrip.Text, Convert.ToDouble(txtprice.Text), "~/img/" + FileUpload1.FileName, Convert.ToInt32(txtquan.Text), DropDownList1.SelectedItem.Text, "~/img/" + FileUpload2.FileName, "~/img/" + FileUpload3.FileName, "~/img/" + FileUpload4.FileName, txtmodel.Text, drpcolor.SelectedItem.Text, drptouch.SelectedItem.Text, drpsim.SelectedItem.Text, txtram.Text, drpmemory.SelectedItem.Text, txtdisplay.Text, txtcamera.Text, txtbattery.Text); IDT = DsAdapter.select(); GridView1.DataSource = IDT; GridView1.DataBind(); txtdescrip.Text = ""; txtiname.Text = ""; txtprice.Text = ""; txtmodel.Text = ""; txtdisplay.Text = ""; txtbattery.Text = ""; txtcamera.Text = ""; txtram.Text = ""; drpsim.SelectedIndex = 0; drptouch.SelectedIndex = 0; drpmemory.SelectedIndex = 0; drpcolor.SelectedIndex = 0; txtquan.Text = ""; drpcolor.SelectedIndex = 0; DropDownList1.SelectedIndex = 0; lblmsg.Text = "Items Added Successfully"; }
protected void Button3_Click(object sender, EventArgs e) { string ext = Path.GetExtension(FileUpload4.FileName); Console.WriteLine(ext); if (FileUpload4.HasFile) { if (ext.Equals(".xml")) { FileUpload4.SaveAs(Server.MapPath("~/ArchivosXml/Precios.xml")); Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>alert('" + "Se subio con exito" + "');</script>"); //try { CargarPrecios(); Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>alert('" + "Se cargaron los datos con exito" + "');</script>"); } //catch (Exception) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>alert('" + "Error al cargar datos" + "');</script>"); } } else { Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>alert('" + "Error! El archivo debe ser tipo XML" + "');</script>"); } } else { Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>alert('" + "Error! Seleccione un archivo XML" + "');</script>"); } }
public void pictures() { var orgID = HttpContext.Current.Session["orgID"]; if (FileUpload2.PostedFile != null && FileUpload2.PostedFile.FileName != "") { var ext = FileUpload2.FileName.Split('.')[FileUpload2.FileName.Split('.').Length - 1]; FileUpload2.SaveAs(Server.MapPath("Images/Organizations/" + orgID + ".1." + ext)); } if (FileUpload3.PostedFile != null && FileUpload3.PostedFile.FileName != "") { var ext = FileUpload3.FileName.Split('.')[FileUpload3.FileName.Split('.').Length - 1]; FileUpload3.SaveAs(Server.MapPath("Images/Organizations/" + orgID + ".2." + ext)); } if (FileUpload4.PostedFile != null && FileUpload4.PostedFile.FileName != "") { var ext = FileUpload4.FileName.Split('.')[FileUpload4.FileName.Split('.').Length - 1]; FileUpload4.SaveAs(Server.MapPath("Images/Organizations/" + orgID + ".3." + ext)); } if (FileUpload5.PostedFile != null && FileUpload5.PostedFile.FileName != "") { var ext = FileUpload5.FileName.Split('.')[FileUpload5.FileName.Split('.').Length - 1]; FileUpload5.SaveAs(Server.MapPath("Images/Organizations/" + orgID + "." + ext)); } }
protected void Butstud_Click(object sender, EventArgs e) { if (Textstud1.Text == "") { Labmsg.Text = "ENTER DATA...!"; Labmsg.ForeColor = System.Drawing.Color.DarkRed; } else { String constring = "Data Source=LAPTOP-7GMLR3NS;Initial Catalog=managementsystem;Integrated Security=True"; SqlConnection sqlcon = new SqlConnection(constring); FileUpload1.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload1.FileName)); String link = "images" + Path.GetFileName(FileUpload1.FileName); FileUpload2.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload2.FileName)); String link1 = "images" + Path.GetFileName(FileUpload2.FileName); FileUpload3.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload3.FileName)); String link2 = "images" + Path.GetFileName(FileUpload3.FileName); FileUpload4.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload4.FileName)); String link3 = "images" + Path.GetFileName(FileUpload4.FileName); String query = "Insert into Student_Documents(StudentName,StudentId,profileimg,aadharimg,sscimg,hscimg) values('" + Textstud1.Text + "','" + Textstud2.Text + "','" + link + "','" + link1 + "','" + link2 + "','" + link3 + "')"; SqlCommand cmd = new SqlCommand(query, sqlcon); sqlcon.Open(); cmd.ExecuteNonQuery(); Labmsg.Text = "SAVED SUCCESSFULLY...!"; Labmsg.ForeColor = System.Drawing.Color.DarkGreen; sqlcon.Close(); Textstud1.Text = ""; Textstud2.Text = ""; } }
protected void Button3_Click(object sender, EventArgs e) { if (FileUpload2.HasFile) { FileUpload2.SaveAs(Server.MapPath("~/images/Slider/" + "1.jpg")); } Label4.Text = " İŞLEM BAŞARILI"; if (FileUpload3.HasFile) { FileUpload3.SaveAs(Server.MapPath("~/images/Slider/" + "2.jpg")); } Label4.Text = " İŞLEM BAŞARILI"; if (FileUpload4.HasFile) { FileUpload4.SaveAs(Server.MapPath("~/images/Slider/" + "3.jpg")); } Label4.Text = " İŞLEM BAŞARILI"; if (FileUpload5.HasFile) { FileUpload5.SaveAs(Server.MapPath("~/images/Slider/" + "4.jpg")); } Label4.Text = " İŞLEM BAŞARILI"; }
protected void Button3_Click(object sender, EventArgs e) { try { if (FileUpload4.PostedFile != null && FileUpload4.HasFile) { string imgFile1 = Path.GetFileName(FileUpload4.PostedFile.FileName); FileUpload4.SaveAs(Server.MapPath("Images/" + imgFile1)); SqlConnection conn = new SqlConnection(con1); SqlCommand cmd1 = new SqlCommand("update Catagories set cat_Img=@img where cat_id=@id", conn); cmd1.Parameters.AddWithValue("@img", "Images/" + imgFile1); cmd1.Parameters.AddWithValue("@id", Convert.ToInt32(DropDownList3.SelectedItem.Value)); conn.Open(); cmd1.ExecuteNonQuery(); conn.Close(); conn.Dispose(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Save Successfully')", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please Select The File')", true); } } catch (SqlException ex) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Error : '+'" + ex.Message + "')", true); } }
protected void BtnSave_Click(object sender, EventArgs e) { Product p = new Product(); p.ProductName = TxtPname.Text; p.Description = TxtDescription.Text; p.CategoryId = int.Parse(DropDownList1.SelectedItem.Value); p.Weight = TxtWeight.Text; p.Price = int.Parse(TxtPrice.Text); p.Dimentions = TxtDiamentions.Text; p.Composition = TxtCompositions.Text; p.SizeDfit = TxtSizeDfit.Text; p.OtherInfo = TxtOtherInfo.Text; p.Size = TxtSize.Text; p.Color = TxtColor.Text; p.Pimage1 = FileUpload1.FileName; p.Pimage2 = FileUpload2.FileName; p.Pimage3 = FileUpload3.FileName; p.Pimage4 = FileUpload4.FileName; FileUpload1.SaveAs(Server.MapPath("~/Image/" + FileUpload1.FileName)); FileUpload2.SaveAs(Server.MapPath("~/image/" + FileUpload2.FileName)); FileUpload3.SaveAs(Server.MapPath("~/image/" + FileUpload3.FileName)); FileUpload4.SaveAs(Server.MapPath("~/image/" + FileUpload4.FileName)); ProductHelper.InsertProduct(p); Response.Redirect("AddProduct"); }
protected void btnUpload_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { FileUpload1.SaveAs(MapPath("~/images/House4/" + FileUpload1.FileName)); imgViewFile.ImageUrl = "~/images/House4/" + FileUpload1.FileName; } if (FileUpload2.HasFile) { FileUpload2.SaveAs(MapPath("~/images/House4/" + FileUpload2.FileName)); imgA.ImageUrl = "~/images/House4/" + FileUpload2.FileName; } if (FileUpload3.HasFile) { FileUpload3.SaveAs(MapPath("~/images/House4/" + FileUpload3.FileName)); imgB.ImageUrl = "~/images/House4/" + FileUpload3.FileName; } if (FileUpload4.HasFile) { FileUpload4.SaveAs(MapPath("~/images/House4/" + FileUpload4.FileName)); imgC.ImageUrl = "~/images/House4/" + FileUpload4.FileName; } if (FileUpload5.HasFile) { FileUpload5.SaveAs(MapPath("~/images/House4/" + FileUpload5.FileName)); imgD.ImageUrl = "~/images/House4/" + FileUpload5.FileName; } }
protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e) { if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "" || TextBox4.Text == "" || !FileUpload1.HasFile || !FileUpload2.HasFile || !FileUpload3.HasFile || !FileUpload4.HasFile || TextBox16.Text == "" || TextBox17.Text == "" || TextBox18.Text == "" || TextBox19.Text == "" || TextBox20.Text == "") { Label1.Text = "Please innput all the data"; } else { String pic1, pic2, pic3, pic4; cn.Open(); pic1 = "~/post/" + FileUpload1.FileName; FileUpload1.SaveAs(MapPath(pic1)); pic2 = "~/post/" + FileUpload2.FileName; FileUpload2.SaveAs(MapPath(pic2)); pic3 = "~/post/" + FileUpload3.FileName; FileUpload3.SaveAs(MapPath(pic3)); pic4 = "~/post/" + FileUpload4.FileName; FileUpload4.SaveAs(MapPath(pic4)); cmd = new SqlCommand("Insert into house values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox5.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + pic1 + "','" + pic2 + "','" + pic3 + "','" + pic4 + "','" + TextBox16.Text + "','" + TextBox17.Text + "','" + TextBox18.Text + "','" + TextBox19.Text + "','" + TextBox20.Text + "')", cn); cmd.ExecuteNonQuery(); cn.Close(); Response.Write("<Script>alert('Thank you for joing us')</Script>"); Response.Write("<Script>location.href = 'menubar.aspx';</Script>"); } }
protected void Button1_Click(object sender, EventArgs e) { string desig = "2"; string gen; if (RadioButton3.Checked == true) gen = "Male"; else gen = "Female"; string file1 = ""; string file2 = ""; string toPath1 = ""; string toPath2 = ""; file1 = FileUpload3.FileName.ToString(); file2 = FileUpload4.FileName.ToString(); toPath1 = Server.MapPath(".") + "/epics/" + file1; toPath2 = Server.MapPath(".") + "/proof/" + file2; if (FileUpload3.HasFile) FileUpload3.SaveAs(toPath1); if (FileUpload4.HasFile) FileUpload4.SaveAs(toPath2); string f1 = ""; string f2 = ""; string.Format("~/epics/{0}", f1); string.Format("~/proof/{0}", f2); con.Open(); string s2 = "insert into etbl values('" + Label7.Text + "','" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + desig + "','" + TextBox5.Text + "','" + file1 + "','" + file2 + "','" + TextBox6.Text + "','"+gen+"')"; SqlCommand cmd2 = new SqlCommand(s2, con); cmd2.ExecuteNonQuery(); MessageBox.Show("Employee added succesfully."); con.Close(); Response.Redirect("addemp.aspx"); }
protected void btnRRegister_Click(object sender, EventArgs e) { string imagefile = "notavailable.jpg"; if (FileUpload4.HasFile) //checking whether the file upload has the file { imagefile = FileUpload4.FileName; FileUpload4.SaveAs(Server.MapPath("~/images/" + imagefile));//store the file in the images folder } //restaurant Random rndRandom = new Random(); int newLicNo = rndRandom.Next(1, 1000); Restaurant r = new Restaurant() { OrgEmail = tbxREmail.Text, Name = tbxRName.Text, RegID = tbxRRegID.Text, Address = tbxRAddress.Text, PostalCode = tbxRPostalCode.Text, City = tbxRCity.Text, Country = tbxRCountry.Text, Password = tbxRPassword.Text, ContactNo = tbxRPhone.Text, Description = "Not Applicable", License = "RR" + newLicNo, StarRating = Convert.ToInt32(5), Photo = imagefile, OpeningHours = tbxAHour.Text, Verification = false }; int id = RestaurantDB.insertRestaurant(r); lblOutput.Text = id + "Registered Successfully!"; }
protected void btnaddrest_Click(object sender, EventArgs e) { if (RadioButtonList1.SelectedIndex < 0) { Response.Write("<script>alert('Thank you for rating us');</script>"); Response.Redirect(Request.RawUrl); } int feenum = 0; coon.Open(); int rescode = 0; string restCode; string query1 = "SELECT MAX(Res_Code) FROM tblrestaurant"; OdbcCommand cmd1 = new OdbcCommand(query1, coon); OdbcDataReader adt = cmd1.ExecuteReader(); while (adt.Read()) { rescode = Convert.ToInt32(adt[0].ToString().Substring(1, 2)) + 1; } restCode = "R" + rescode; if (FileUpload3.HasFile && FileUpload4.HasFile) { FileUpload3.SaveAs(Server.MapPath("~/Restaurants/" + FileUpload3.FileName)); FileUpload4.SaveAs(Server.MapPath("~/Restaurants/" + FileUpload3.FileName)); lbllogo.Text = "File Uploaded"; lblupl2.Text = "File Uploaded"; lbllogo.Visible = true; lblupl2.Visible = true; lbllogo.ForeColor = System.Drawing.Color.Green; lblupl2.ForeColor = System.Drawing.Color.Green; string imagename = FileUpload3.FileName; string imagename2 = FileUpload4.FileName; string path = "~//Restaurants//" + imagename.ToString(); string path2 = "~//Restaurants//" + imagename2.ToString(); feenum = Convert.ToInt32(RadioButtonList1.SelectedItem.Value); string query = "INSERT INTO tblpayment(Payment_Date,Fee_Num,Res_Code) VALUES('" + DateTime.Now.ToShortDateString() + "','" + feenum + "','" + restCode + "')"; string query2 = "INSERT INTO tblrestaurant(Res_Code,Res_Name,Res_TelNo,Res_Town,Res_Logo,Res_Loc,Res_Web,Res_Address) VALUES('" + restCode + "','" + txtname.Text + "','" + txttell.Text + "','" + DropDownList1.SelectedValue + "','" + path + "','" + path2 + "','" + txtwb.Text + "','" + txtwb.Text + "')"; OdbcCommand cmd2 = new OdbcCommand(query2, coon); OdbcCommand cmd = new OdbcCommand(query, coon); cmd2.ExecuteNonQuery(); cmd.ExecuteNonQuery(); lbladdedRes.Text = "Restuarent Added within 3 working days"; lbladdedRes.Visible = true; } else { lbllogo.Text = "File Not Uploaded"; lblupl2.Text = "File Not Uploaded"; lbllogo.Visible = true; lblupl2.Visible = true; lbllogo.ForeColor = System.Drawing.Color.Red; lblupl2.ForeColor = System.Drawing.Color.Red; } }
protected void btn第四張圖_Click(object sender, EventArgs e) { if (FileUpload4.HasFile) { string savePath = Server.MapPath(@"/./images/4.jpg"); FileUpload4.SaveAs(savePath); lbl4.Visible = true; lbl4.Text = "上傳成功"; } }
private void UpLoadAndDisplay3() { string imgName = FileUpload4.FileName; string imgPath = "/assets/image/" + "Question" + imgName; int imgSize = FileUpload4.PostedFile.ContentLength; if (FileUpload4.PostedFile != null && FileUpload4.PostedFile.FileName != "") { FileUpload4.SaveAs(Server.MapPath(imgPath)); Image4.ImageUrl = ".." + imgPath; } }
protected void BtnPest1_Click(object sender, EventArgs e) { if ((TBPest1.Text == "") && (TBPest2.Text == "") && (TBPest3.Text == "")) { LblResult.Text = "Enter the required Fields"; LblResult.Visible = true; return; } else { if (FileUpload4.HasFile) { try { if (FileUpload4.PostedFile.ContentType == "image/jpeg") { if (FileUpload4.PostedFile.ContentLength < 512000) { string filename = Path.GetFileName(FileUpload4.FileName); FileUpload4.SaveAs(Server.MapPath("store/" + FileUpload4.FileName)); LblResult.Text = "File uploaded successfully!"; LblResult.Visible = true; } else { LblResult.Text = "File maximum size is 500 Kb"; } } else { LblResult.Text = "Only JPEG files are accepted!"; } } catch (Exception exc) { LblResult.Text = "The file could not be uploaded. The following error occured: " + exc.Message; } } mycon = new SqlConnection(con); mycon.Open(); //FileUpload4.SaveAs(Server.MapPath("store/" + FileUpload4.FileName)); string insert = "insert into Krishibhavan.dbo.online(type,name,description,prize,picture) values('pesticide','" + TBPest1.Text + "','" + TBPest2.Text + "','" + TBPest3.Text + "','store/" + FileUpload4.FileName + "')"; cmd = new SqlCommand(insert, mycon); cmd.ExecuteNonQuery(); mycon.Close(); Panel1.Visible = false; LblResult.Text = "New Pesticide Added Successfully"; LblResult.Visible = true; } }
//上传主动邀请图片 protected void Button5_Click(object sender, EventArgs e) { Label2.Visible = false; string bgStyle = this.FileUpload3.FileName; string okbtn = this.FileUpload4.FileName; string nobtn = this.FileUpload5.FileName; if (string.IsNullOrEmpty(bgStyle) || string.IsNullOrEmpty(okbtn) || string.IsNullOrEmpty(nobtn)) { Label2.Text = "请选择上传图片"; this.ModalPopupExtender2.Show(); return; } if (!string.IsNullOrEmpty(LoadImageType(bgStyle)) || !string.IsNullOrEmpty(LoadImageType(okbtn)) || !string.IsNullOrEmpty(LoadImageType(nobtn))) { Label2.Text = "图片,请上传格式为jpg,gif,png,bmp图片"; this.ModalPopupExtender2.Show(); return; } WebSite wst = WebSiteManager.GetWebSiteByDomainName(this.drpDomainName.SelectedValue); if (wst != null) { if (Session["User"] != null) { oper = (Operator)Session["User"]; string path = ConfigurationManager.AppSettings["UserDefinedPath"] + "\\" + oper.Account.AccountNumber + "\\" + drpDomainName.SelectedValue; Directory.CreateDirectory(path); string aa = LiveSupport.BLL.WebSiteManager.WebSite_UserDefined; string inviteBGimg = "invite_bg" + aa + Path.GetExtension(bgStyle); string inviteOKimg = "btn_ok" + aa + Path.GetExtension(okbtn); string inviteNOimg = "btn_no" + aa + Path.GetExtension(nobtn); FileUpload3.SaveAs(path + "\\" + inviteBGimg); FileUpload4.SaveAs(path + "\\" + inviteOKimg); FileUpload5.SaveAs(path + "\\" + inviteNOimg); wst.InviteStyle = aa + "|" + inviteBGimg + "|" + inviteOKimg + "|" + inviteNOimg; WebSiteManager.Update(wst); AddIcoLocation(wst.IcoLocation); AddBannerStyle(wst.IconStyle); AddInviteStyle(wst.InviteStyle); AddChatStyle(wst.ChatStyle); } else { Response.Redirect("../Index.aspx"); } } else { Response.Write("<script>alert('请选择上传到那个域名!');</script>"); } }
protected void Button5_Click(object sender, EventArgs e) { if (FileUpload4.HasFile) { FileUpload4.SaveAs(@"C:\Users\KA20094837\Desktop\Jacob\" + FileUpload4.FileName); Label11.ForeColor = System.Drawing.Color.ForestGreen; Label11.Text = "File Uploaded: " + FileUpload4.FileName; } else { Label11.Text = "No File Uploaded."; } }
List <string> SaveImage(int gfid) { List <string> listurl = new List <string>(); string newName; if (FileUpload1.FileName != "") { System.IO.FileInfo f = new System.IO.FileInfo(FileUpload1.FileName); newName = "Girl" + gfid + "-" + Guid.NewGuid().ToString("N") + f.Extension; FileUpload1.SaveAs(Server.MapPath("/") + "Content/Image/" + newName); listurl.Add(newName); } if (FileUpload2.FileName != "") { System.IO.FileInfo f = new System.IO.FileInfo(FileUpload2.FileName); newName = "Girl" + gfid + "-" + Guid.NewGuid().ToString("N") + f.Extension; FileUpload2.SaveAs(Server.MapPath("/") + "Content/Image/" + newName); listurl.Add(newName); } if (FileUpload3.FileName != "") { System.IO.FileInfo f = new System.IO.FileInfo(FileUpload3.FileName); newName = "Girl" + gfid + "-" + Guid.NewGuid().ToString("N") + f.Extension; FileUpload3.SaveAs(Server.MapPath("/") + "Content/Image/" + newName); listurl.Add(newName); } if (FileUpload4.FileName != "") { System.IO.FileInfo f = new System.IO.FileInfo(FileUpload4.FileName); newName = "Girl" + gfid + "-" + Guid.NewGuid().ToString("N") + f.Extension; FileUpload4.SaveAs(Server.MapPath("/") + "Content/Image/" + newName); listurl.Add(newName); } if (FileUpload5.FileName != "") { System.IO.FileInfo f = new System.IO.FileInfo(FileUpload5.FileName); newName = "Girl" + gfid + "-" + Guid.NewGuid().ToString("N") + f.Extension; FileUpload5.SaveAs(Server.MapPath("/") + "Content/Image/" + newName); listurl.Add(newName); } if (FileUpload6.FileName != "") { System.IO.FileInfo f = new System.IO.FileInfo(FileUpload6.FileName); newName = "Girl" + gfid + "-" + Guid.NewGuid().ToString("N") + f.Extension; FileUpload6.SaveAs(Server.MapPath("/") + "Content/Image/" + newName); listurl.Add(newName); } return(listurl); }
protected void btnupload_Click(object sender, EventArgs e) { FileUpload2.SaveAs(Server.MapPath(img1)); Image1.ImageUrl = img1; FileUpload3.SaveAs(Server.MapPath(img2)); Image2.ImageUrl = img2; FileUpload4.SaveAs(Server.MapPath(img3)); Image3.ImageUrl = img3; FileUpload5.SaveAs(Server.MapPath(img4)); Image4.ImageUrl = img4; FileUpload6.SaveAs(Server.MapPath(img5)); Image5.ImageUrl = img5; FileUpload7.SaveAs(Server.MapPath(img6)); Image6.ImageUrl = img6; }
protected void Button1_Click(object sender, EventArgs e) { rob.RoomID = Convert.ToInt32(Request.QueryString["RoomID"].ToString()); rob.RoomName = RoomName.Text; rob.RoomTypeID = Convert.ToInt32(DDLRoomType.SelectedValue.ToString()); rob.Rate = Convert.ToSingle(Rate.Text); if (FileUpload1.HasFile) { rob.Image1 = FileUpload1.FileName; FileUpload1.SaveAs(Server.MapPath("../Upload/" + FileUpload1.FileName)); } else { rob.Image1 = img1; } if (FileUpload2.HasFile) { rob.Image2 = FileUpload2.FileName; FileUpload2.SaveAs(Server.MapPath("../Upload/" + FileUpload2.FileName)); } else { rob.Image2 = img2; } if (FileUpload3.HasFile) { rob.Image3 = FileUpload3.FileName; FileUpload3.SaveAs(Server.MapPath("../Upload/" + FileUpload3.FileName)); } else { rob.Image3 = img3; } if (FileUpload4.HasFile) { rob.Image = FileUpload4.FileName; FileUpload4.SaveAs(Server.MapPath("../Upload/" + FileUpload4.FileName)); } else { rob.Image = img; } rod.Update(rob); clear(); Response.Redirect("RoomView.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { try { con.Open(); cmd = new SqlCommand("select * from registration where email='" + Session["email"] + "'", con); dr = cmd.ExecuteReader(); dr.Read(); string email = dr["email"].ToString(); string uploader_name = dr["username"].ToString(); string uploader_category = dr["youare"].ToString(); string uploader_id = dr["id"].ToString(); con.Close(); string path = Server.MapPath("Images/"); string ext1 = Path.GetExtension(FileUpload1.FileName); FileUpload1.SaveAs(path + FileUpload1.FileName); string name1 = "Images/" + FileUpload1.FileName; string ext2 = Path.GetExtension(FileUpload2.FileName); FileUpload2.SaveAs(path + FileUpload2.FileName); string name2 = "Images/" + FileUpload2.FileName; FileUpload3.SaveAs(path + FileUpload3.FileName); string ext3 = Path.GetExtension(FileUpload3.FileName); string name3 = "Images/" + FileUpload3.FileName; FileUpload4.SaveAs(path + FileUpload4.FileName); string ext4 = Path.GetExtension(FileUpload4.FileName); string name4 = "Images/" + FileUpload4.FileName; con.Open(); cmd = new SqlCommand("insert into sell (property_name,property_for,property_type,state,city,locality_address,floor,bed_rooms,bath_rooms,store_rooms,age_of_construction,authority_verification,landmarks,category,area,price,contact_number,zip_code,description,image1,image2,image3,image4,email,uploader_name,uploader_category,uploader_id) values('" + TextBox1.Text + "','" + DropDownList1.Text + "','" + DropDownList2.Text + "','" + DropDownList3.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + DropDownList4.Text + "','" + DropDownList5.Text + "','" + DropDownList6.Text + "','" + DropDownList7.Text + "','" + DropDownList8.Text + "','" + TextBox4.Text + "','" + TextBox6.Text + "','" + DropDownList10.Text + "','" + TextBox5.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + TextBox10.Text + "','" + TextBox9.Text + "','" + name1 + "','" + name2 + "','" + name3 + "','" + name4 + "','" + email + "','" + uploader_name + "','" + uploader_category + "','" + uploader_id + "')", con); cmd.ExecuteNonQuery(); con.Close(); count++; Response.Redirect("sell.aspx"); } catch (SqlException) { Label1.ForeColor = System.Drawing.Color.Red; Label1.Text = "Something Went Wrong"; } }
protected void Button5_Click(object sender, EventArgs e) { string strMsgSuccess = "Upload Success"; string strMsgSelect = "Please select your file"; if (FileUpload4.HasFile) { String strFileName = FileUpload4.FileName; FileUpload4.SaveAs(Server.MapPath("lecture4/" + strFileName)); //Response.Write("<script> alert('Upload Success');<script>"); TextBox4.Text = strMsgSuccess; } else { //Response.Write("<script> alert('Pleases select your file');<script>"); TextBox4.Text = strMsgSelect; } }
protected void Button4_Click(object sender, EventArgs e) { if (FileUpload4.HasFile) { DataSet ds = new DataSet(); ds.ReadXml(Server.MapPath("~/slider.xml")); File.Delete(Server.MapPath("~/" + ds.Tables[0].Rows[3]["resim"])); string uzanti = FileUpload4.FileName.Substring(FileUpload4.FileName.Length - 3, 3); string dosyaadi = "slider4" + "." + uzanti; FileUpload4.SaveAs(Server.MapPath("~/slider/") + dosyaadi); ds.Tables[0].Rows[3]["resim"] = "slider/" + dosyaadi; ds.WriteXml(Server.MapPath("~/slider.xml")); Response.Write("<script lang='JavaScript'>alert('Slider4 başarıyla güncellenmiştir...');</script>"); } else { Response.Write("<script lang='JavaScript'>alert('Resim Seçin!');</script>"); } }
protected void btnuploadsinglegroup_Click(object sender, EventArgs e) { att3.Text = ""; att4.Text = ""; if (FileUpload3.HasFile != false) { FileUpload3.SaveAs(Server.MapPath("~/att/" + Session["uid"].ToString() + "_" + FileUpload3.FileName.ToString())); att3.Text = FileUpload3.FileName.ToString(); } if (FileUpload4.HasFile != false) { FileUpload4.SaveAs(Server.MapPath("~/att/" + Session["uid"].ToString() + "_" + FileUpload4.FileName.ToString())); att4.Text = FileUpload4.FileName.ToString(); } FileUpload4.Visible = false; FileUpload3.Visible = false; btnuploadsinglegroup.Visible = false; MultiView1.ActiveViewIndex = 1; }
protected void Button1_Click(object sender, EventArgs e) { string f1 = "", f2 = "", f3 = "", f4 = ""; cmd = new SqlCommand("select count(*) from questions where organization='" + org + "' and ename='" + en + "'", conn); object n = cmd.ExecuteScalar(); int count; count = (int)n; count++; if (FileUpload1.HasFile) { FileUpload1.SaveAs("C:\\Users\\Bharath\\Desktop\\project\\WebApplication1\\WebApplication1\\images\\" + FileUpload1.FileName); f1 = "~/images/" + FileUpload1.FileName; } if (FileUpload2.HasFile) { FileUpload2.SaveAs("C:\\Users\\Bharath\\Desktop\\project\\WebApplication1\\WebApplication1\\images\\" + FileUpload1.FileName); f2 = "~/images/" + FileUpload2.FileName; } if (FileUpload3.HasFile) { FileUpload3.SaveAs("C:\\Users\\Bharath\\Desktop\\project\\WebApplication1\\WebApplication1\\images\\" + FileUpload1.FileName); f3 = "~/images/" + FileUpload3.FileName; } if (FileUpload4.HasFile) { FileUpload4.SaveAs("C:\\Users\\Bharath\\Desktop\\project\\WebApplication1\\WebApplication1\\images\\" + FileUpload1.FileName); f4 = "~/images/" + FileUpload4.FileName; } cmd = new SqlCommand("insert into questions values('" + org + "','" + en + "'," + count + ",'" + TextBox1.Text + "')", conn); cmd.ExecuteNonQuery(); cmd = new SqlCommand("insert into options values('" + org + "','" + en + "'," + count + ",'" + TextBox2.Text + "'," + 0 + ",'" + TextBox1.Text + "','" + TextBox6.Text + "','" + f1 + "')", conn); cmd.ExecuteNonQuery(); cmd = new SqlCommand("insert into options values('" + org + "','" + en + "'," + count + ",'" + TextBox3.Text + "'," + 0 + ",'" + TextBox1.Text + "','" + TextBox7.Text + "','" + f2 + "')", conn); cmd.ExecuteNonQuery(); cmd = new SqlCommand("insert into options values('" + org + "','" + en + "'," + count + ",'" + TextBox4.Text + "'," + 0 + ",'" + TextBox1.Text + "','" + TextBox8.Text + "','" + f3 + "')", conn); cmd.ExecuteNonQuery(); cmd = new SqlCommand("insert into options values('" + org + "','" + en + "'," + count + ",'" + TextBox5.Text + "'," + 0 + ",'" + TextBox1.Text + "','" + TextBox9.Text + "','" + f4 + "')", conn); cmd.ExecuteNonQuery(); Response.Redirect("Questions.aspx"); conn.Close(); }