protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (FileUpload1.HasFile && FileUpload2.HasFile) { FileUpload1.SaveAs(Server.MapPath("filmafis/" + FileUpload1.FileName)); string rsm = "~/filmafis/" + FileUpload1.FileName; FileUpload2.SaveAs(Server.MapPath("filmafis/" + FileUpload2.FileName)); string video = "~/filmafis/" + FileUpload2.FileName; baglanti.Open(); OleDbCommand ekle = new OleDbCommand(); ekle.Connection = baglanti; ekle.CommandText = ("insert into film(filmadi,yil,oyuncular,yonetmen,icerik,afis,fragman,tur_id)Values(@filmadi,@yil,@oyuncular,@yonetmen,@icerik,@afis,@fragman,@tur_id)"); ekle.Parameters.AddWithValue("@filmadi", filmadi.Text); ekle.Parameters.AddWithValue("@yil", yıl.Text); ekle.Parameters.AddWithValue("@oyuncular", oyuncu.Text); ekle.Parameters.AddWithValue("@yonetmen", yonetmen.Text); ekle.Parameters.AddWithValue("@icerik", icerik.Text); ekle.Parameters.AddWithValue("@afis", rsm); ekle.Parameters.AddWithValue("@fragman", video); ekle.Parameters.AddWithValue("@tur_id", DropDownList1.SelectedValue); ekle.ExecuteNonQuery(); baglanti.Close(); vericek(); filmadi.Text = ""; yıl.Text = ""; oyuncu.Text = ""; yonetmen.Text = ""; icerik.Text = ""; } else { Response.Write("Başarısız İşlem!"); } }
protected void Button2_Click(object sender, EventArgs e) { string extn = string.Empty; emptyupload.Visible = false; if (FileUpload2.HasFile) { extn = System.IO.Path.GetExtension(FileUpload2.FileName); if (extn == ".csv" || extn == ".xlsx") { FileUpload2.SaveAs(Server.MapPath("~/ups/spec/") + Session["Log"] + ".csv"); Label1.Text = "Uploaded sucessfully"; Label1.ForeColor = System.Drawing.Color.ForestGreen; Label1.Visible = true; StreamWriter flwrite = File.CreateText(Server.MapPath("~/ups/spec/") + Session["Log"] + ".txt"); flwrite.WriteLine(TxtPhone.Text); flwrite.Close(); } else { Label1.Visible = true; Label1.ForeColor = System.Drawing.Color.DarkRed; Label1.Text = "Invalid file format"; } } else { Label1.ForeColor = System.Drawing.Color.DarkRed; Label1.Text = "Choose your file"; Label1.Visible = true; } }
protected void Button3_Click(object sender, EventArgs e) { String fliname2 = FileUpload2.FileName.ToString(); if (fliname2 == "") { Label4.Text = "请选择文件"; } else if (fliname2.EndsWith(".mp4") || fliname2.EndsWith(".avi") || fliname2.EndsWith(".wmv")) { String path = Server.MapPath("~\\video\\" + fliname2); FileUpload2.SaveAs(path); Label4.Text = "上传成功"; int IndexofA = path.LastIndexOf("\\"); int IndexofB = path.LastIndexOf("."); Session["videoname"] = "video/" + path.Substring(IndexofA + 1, IndexofB - IndexofA + 3); Label2.Visible = false; if (Button1.Text == "修改") { Page page = (Page)HttpContext.Current.Handler; page.ClientScript.RegisterStartupScript(page.GetType(), "js", "<script>document.getElementById('body').style=\"background-image:url('fm/xgbj.jpg');background-size:cover;color:white;\"</script>"); } } else { Label4.Text = "文件类型不正确"; } String tp = FileUpload1.FileName.ToString(); }
protected void btnAdjuntarRespuesta_Click(object sender, EventArgs e) { if (FileUpload2.HasFile) { string fileguid = Guid.NewGuid().ToString(); string FileName = FileUpload2.FileName; try { FileUpload2.SaveAs(Server.MapPath("../../ModuloUsuario/View/Uploads/") + fileguid); } catch { //error.... return; } int i = document_attachment_Insert(FileName, fileguid, null, Convert.ToInt32(txtIDRespuesta.Text), 1); if (i == 0) { //error.... } else { Archivo a = new Archivo(); a.IDArchivo = i; arch.Add(a); Response.Redirect("Det_facturacion.aspx?ot=" + Request.QueryString["ot"] + "&IDMensaje=" + txtIDMensaje.Text + "&Co=" + txtRespuesta.Text + "&IDRespuesta=" + txtIDRespuesta.Text); } } }
protected void Button1_Click(object sender, EventArgs e) { string ext = Path.GetExtension(FileUpload2.FileName); Console.WriteLine(ext); if (FileUpload2.HasFile) { if (ext.Equals(".xml")) { FileUpload2.SaveAs(Server.MapPath("~/ArchivosXml/Categorias.xml")); Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>alert('" + "Se subio con exito" + "');</script>"); //try { CargarCategorias(); 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>"); } }
protected void btnARegister_Click(object sender, EventArgs e) { string imagefile = "notavailable.jpg"; if (FileUpload2.HasFile) //checking whether the file upload has the file { imagefile = FileUpload2.FileName; FileUpload2.SaveAs(Server.MapPath("~/images/" + imagefile));//store the file in the images folder } //attraction Attraction a = new Attraction() { OrgEmail = tbxAEmail.Text, Name = tbxAName.Text, RegID = tbxARegID.Text, Address = tbxAddressA.Text, PostalCode = tbxAPostalCode.Text, City = tbxACity.Text, Country = tbxACountry.Text, Password = tbxAPassword.Text, ContactNo = tbxAPhone.Text, Description = "Not Applicable", StarRating = Convert.ToInt32(5), OpeningHours = tbxAHour.Text, Photo = imagefile, Verification = false }; int id = AttractionDB.insertAttraction(a); lblOutput.Text = id + "Registered Successfully!"; }
protected void Button1_Click(object sender, EventArgs e) { SqlConnection connection = new SqlConnection(connectionString); FileUpload2.SaveAs(Server.MapPath("~/ImageFile/") + Path.GetFileName(FileUpload2.FileName)); FileUpload1.SaveAs(Server.MapPath("~/ImageFile/") + Path.GetFileName(FileUpload1.FileName)); string link1 = "ImageFile/" + Path.GetFileName(FileUpload2.FileName); string link2 = "ImageFile/" + Path.GetFileName(FileUpload1.FileName); bool gender; if (RadioButton1.Checked == true) { gender = true; } else { gender = false; } bool active = CheckBox1.Checked == true; string query = "INSERT INTO FileUploads(Name, Image, Files, Gender, BirthDate,CreateDate, Active) VALUES('" + TextBox1.Text + "','" + link1 + "','" + link2 + "', '" + gender + "', '" + Date.Value + "',GETDATE(),'" + active + "' )"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); int rowEffect = command.ExecuteNonQuery(); connection.Close(); if (rowEffect > 0) { Label1.Text = "Inserted Successfully"; } }
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 btnSave_Click(object sender, EventArgs e) { tblmerchant tb = new tblmerchant(); tb.Categoryid = Convert.ToInt32(ddlCategorytype.SelectedValue.ToString()); tb.Merchantname = txtMerchant.Text; if (FileUpload2.HasFile) { tb.Photo = FileUpload2.FileName; FileUpload2.SaveAs(Server.MapPath("~/ProductImages/" + FileUpload2.FileName)); } else { tb.Photo = "noimage.jpg"; } db.tblmerchants.Add(tb); int i = db.SaveChanges(); if (i > 0) { Image1.ImageUrl = "~/ProductImages/" + FileUpload2.FileName; lblMessage.Text = "merchant Created"; LoadGrid(); } }
protected void btnpupload_Click(object sender, EventArgs e) { FileUpload2.SaveAs(Server.MapPath("~/Member/") + lblbno.Text + "_" + FileUpload2.FileName); UAdapter.USERMST_CHANGE_PICTURE(Convert.ToInt32(Session["uid"].ToString()), "~/Member/" + lblbno.Text + "_" + FileUpload2.FileName); lblpupload.Text = "Profile Picture Updated"; Response.Redirect("LHome.aspx"); }
protected void btmupload_Click1(object sender, EventArgs e) { try { string filename = FileUpload2.FileName; string path = Server.MapPath("/teacherimages/" + filename); if (FileUpload2.HasFile) { int a = check(); if (a == 0) { FileUpload2.SaveAs(path); connection.cmd = new SqlCommand("insert into teacherimage values(" + connection.userid + ",'" + filename + "')"); connection.cmd.Connection = connection.con; connection.cmd.ExecuteNonQuery(); } else { connection.cmd = new SqlCommand("update teacherimage set image='" + filename + "' where tid=" + connection.userid + ")"); connection.cmd.Connection = connection.con; connection.cmd.ExecuteNonQuery(); } } } catch (Exception ex) { } }
protected void btn_img_save_Click1(object sender, EventArgs e) { try { if (FileUpload2.PostedFile != null && STUP_ID != null) { string con1 = System.Configuration.ConfigurationManager.ConnectionStrings["DBMS"].ConnectionString; string imgFile = Path.GetFileName(FileUpload2.PostedFile.FileName); //FileUpload1.SaveAs("C:/Users/rahat/Desktop/bootstrpe/Image/" + imgFile); //C:\Users\rahat\source\repos\signalR\signalR\Image FileUpload2.SaveAs(Server.MapPath("Image/" + imgFile)); SqlConnection conn = new SqlConnection(con1); SqlCommand cmd = new SqlCommand("update Users set Img=@path where User_Id=@user_id", conn); cmd.Parameters.AddWithValue("@path", "Image/" + imgFile); cmd.Parameters.AddWithValue("@user_id", STUP_ID); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); conn.Dispose(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Image Inserted Successfully')", true); } } catch (SqlException ex) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Error : '+'" + ex.Message + "')", true); } }
protected void Button5_Click(object sender, EventArgs e) { string uploadFileName = ""; string uploadFilePath = ""; if (FileUpload2.HasFile) { string ext = Path.GetExtension(FileUpload2.FileName).ToLower(); uploadFileName = Guid.NewGuid().ToString() + ext; uploadFilePath = Path.Combine(Server.MapPath("~/Delivery"), uploadFileName); try { FileUpload2.SaveAs(uploadFilePath); SqlDataSource23.InsertParameters.Add("Message", TextBox2.Text); SqlDataSource23.InsertParameters.Add("Status", "Modification"); SqlDataSource23.InsertParameters.Add("ActionStatus", "Modification"); SqlDataSource23.InsertParameters.Add("Type", "Buyer"); SqlDataSource23.InsertParameters.Add("Attachment", "~/Delivery/" + FileUpload2.FileName); SqlDataSource23.Insert(); TextBox2.Text = string.Empty; } catch (Exception ex) { //lblMsg.Text = ex.Message; } } else { //lblMsg.Text = "Save Successfully"; } }
protected void Button1_Click1(object sender, EventArgs e) { if (FileUpload1.HasFile) { if (!checktype(FileUpload1.FileName)&!checktypeimg(FileUpload2.FileName)) { Label1.Text = "فایل شما ارسال نشد."; } else { DateTime date = DateTime.Now; string vidnews = FileUpload1.FileName; adnewTableAdapters.TableTableAdapter anta = new adnewTableAdapters.TableTableAdapter(); anta.InsertQueryAdminNews(txt_onvan.Text, txt_desc.Text, date, 0, int.Parse(drop_cat.SelectedValue), txt_writer.Text, vidnews,FileUpload2.FileName); Label1.Text = "تبریک فایل شما با موفقیت ارسال شد "; FileUpload1.SaveAs(MapPath("~/vid/" + FileUpload1.FileName)); FileUpload2.SaveAs(MapPath("../imgadmindef/" + FileUpload2.FileName)); GridView1.DataBind(); txt_onvan.Text = " "; txt_desc.Text = " "; txt_writer.Text = " "; } } }
protected void btnsaveProduct_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { FileUpload1.SaveAs(Server.MapPath("Uploadedpix/") + FileUpload1.FileName); lblFullSizeImage.Text = FileUpload1.FileName; } if (FileUpload2.HasFile) { FileUpload2.SaveAs(Server.MapPath("Thumbnails/") + FileUpload2.FileName); } lblThumbSizeImage.Text = FileUpload2.FileName; btnsaveProduct.Visible = true; SqlDataSource1.Insert(); this.lblAddingNewItem.Text = "Item Has Been Added into the Database"; btnsaveProduct.Visible = false; btnInsert.Visible = true; txtPrice.Enabled = false; txtShortDescription.Enabled = false; txtProductDescription.Enabled = false; txtProductName.Enabled = false; dropCatInsert.Enabled = false; }
protected void btnUpdate_Click(object sender, EventArgs e) { int Merchantid = Convert.ToInt32(HiddenField1.Value); tblmerchant tb = db.tblmerchants.Where(u => u.Merchantid == Merchantid).FirstOrDefault(); tb.Categoryid = Convert.ToInt32(ddlCategorytype.SelectedValue.ToString()); tb.Merchantname = txtMerchant.Text; if (FileUpload2.HasFile) { tb.Photo = FileUpload2.FileName; FileUpload2.SaveAs(Server.MapPath("~/ProductImages/" + FileUpload2.FileName)); Image1.ImageUrl = "~/ProductImages/" + FileUpload2.FileName; File.Delete(Server.MapPath("~/ProductImages/" + HiddenField2.Value)); } else { tb.Photo = HiddenField2.Value; } int i = db.SaveChanges(); if (i > 0) { lblMessage.Text = "Merchant Updated"; LoadGrid(); } }
protected void Button4_Click(object sender, EventArgs e) { FileUpload2.SaveAs(Server.MapPath(".") + "/" + FileUpload2.FileName); string conex = System.Configuration.ConfigurationManager.ConnectionStrings["conexion"].ConnectionString; SqlConnection conexion = new SqlConnection(conex); conexion.Open(); SqlCommand comando = new SqlCommand("update noticias set " + " detalle='" + this.TextBox6.Text + "',autor='" + this.TextBox7.Text + "',foto='" + FileUpload2.FileName + "' where titulo ='" + this.TextBox5.Text + "'", conexion); int cantidad = comando.ExecuteNonQuery(); if (cantidad == 1) { Label3.Text = "Datos Modificados"; TextBox5.Text = ""; TextBox6.Text = ""; TextBox7.Text = ""; } else { Label4.Text = "No Existe esta Noticia"; conexion.Close(); } }
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 Button1_Click(object sender, EventArgs e) { string sql = ConfigurationManager.ConnectionStrings["ProjectSystemConnectionString2"].ToString(); SqlConnection conn = new SqlConnection(sql); conn.Open(); string filepath1 = "files/" + FileUpload1.FileName.ToString(); string filepath2 = "files/" + FileUpload2.FileName.ToString(); string savepath1 = Server.MapPath("files/") + FileUpload1.FileName.ToString(); string savepath2 = Server.MapPath("files/") + FileUpload2.FileName.ToString(); FileUpload1.SaveAs(savepath1); FileUpload2.SaveAs(savepath2); string typestring = TypeInput.Text.ToString(); string search = "insert into ProjectTypeInformation(TypeName,ApplyBeginDate,ApplyEndDate,MidBeginDate,MidEndDate,FinalBeginDate,FinalEndDate,MidReportModel,FinalReportModel) values('" + typestring + "','" + applybeginlabel.Text + "','" + applyendlabel.Text + "','" + projmidbegin.Text + "','" + projmidend.Text + "','" + projfinalbegin.Text + "','" + projfinalend.Text + "','" + filepath1 + "','" + filepath2 + "')"; SqlCommand comm = new SqlCommand(); comm.CommandText = search; comm.Connection = conn; SqlDataReader dr = comm.ExecuteReader(); Response.Write("<script>alert('信息添加成功');</script>"); }
protected void Button1_Click(object sender, EventArgs e) { CVTable cv = new CVTable(); cv.Full_Name = Textbox1.Text; cv.Email = TextBox2.Text; cv.Address = TextBox5.Text; cv.Phone = TextBox6.Text; cv.Company = DropDownList1.SelectedValue.ToString(); cv.Apply_For = DropDownList2.SelectedValue.ToString(); if (FileUpload1.HasFile) { FileUpload1.SaveAs(Server.MapPath("~/Dashboard/StudentPic/" + FileUpload1.FileName)); cv.Upload_your_Pic = "/Dashboard/StudentPic/" + FileUpload1.FileName; } if (FileUpload2.HasFile) { FileUpload2.SaveAs(Server.MapPath("~/Dashboard/Studentcv/" + FileUpload2.FileName)); cv.Upload_your_resume = "/Dashboard/Studentcv/" + FileUpload2.FileName; } dl.da.CVTables.InsertOnSubmit(cv); dl.da.SubmitChanges(); Response.Write("<script>alert('Apply Successfull..!')</script>"); Textbox1.Text = TextBox2.Text = TextBox5.Text = TextBox6.Text = ""; DropDownList1.SelectedIndex = DropDownList2.SelectedIndex = 0; }
protected void Button2_Click(object sender, EventArgs e) { if (FileUpload2.HasFile) { string filext = System.IO.Path.GetExtension(FileUpload2.FileName); if (filext == ".jpeg" || filext == ".png" || filext == ".jpg") { try { string filename = Path.GetFileName(FileUpload2.FileName); FileUpload2.SaveAs(Server.MapPath("~/photos/") + "m" + Session["c_id"].ToString() + filext); mfpath = "~/photos/" + "m" + Session["c_id"].ToString() + filext; Label23.Text = "Upload status: File uploaded!"; } catch (Exception ex) { Label23.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; } } else { Label23.Text = "Upload status: Only Image files are accepted!"; } } }
protected void Button1_Click(object sender, EventArgs e) { obj.connect(); string pp = FileUpload1.FileName.ToString(); string pf = FileUpload2.FileName.ToString(); FileUpload1.SaveAs(Server.MapPath("~/productimage/" + pp)); FileUpload2.SaveAs(Server.MapPath("~/productfile/" + pf)); cmd = new SqlCommand("addproduct", obj.con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@pro_image", SqlDbType.VarChar, 200).Value = "~/productimage/" + FileUpload1.FileName.ToString(); cmd.Parameters.Add("@pro_name", SqlDbType.VarChar, 100).Value = txt_name.Text.ToString(); cmd.Parameters.Add("@pro_category", SqlDbType.VarChar, 100).Value = DropDownList1.SelectedItem.Text.ToString(); cmd.Parameters.Add("@pro_technology", SqlDbType.VarChar, 100).Value = txt_tech.Text.ToString(); cmd.Parameters.Add("@operating", SqlDbType.VarChar, 100).Value = TextBoxoperating.Text.ToString(); cmd.Parameters.Add("@about", SqlDbType.VarChar, 500).Value = txt_about.Text.ToString(); cmd.Parameters.Add("@price", SqlDbType.Int).Value = txt_price.Text.ToString(); cmd.Parameters.Add("@pro_file", SqlDbType.VarChar, 500).Value = "~/productfile/" + FileUpload2.FileName.ToString(); cmd.Parameters.Add("@action", SqlDbType.Int).Value = 1; cmd.ExecuteNonQuery(); }
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 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 Button1_Click(object sender, EventArgs e) { if (FileUpload1.HasFile && FileUpload2.HasFile && Id.Text != "" && nom.Text != "" && prenom.Text != "" && date.Text != "" && sexe.Text != "" && email.Text != "" && datee.Text != "" && niveau.Text != "" && comment.Text != "" && login.Text != "" && password.Text != "" && secteur.Text != "") { String imgg = System.IO.Path.GetExtension(FileUpload2.FileName); String filee = System.IO.Path.GetExtension(FileUpload1.FileName); if (imgg != ".jpeg" && imgg != ".png") { alert2.ForeColor = System.Drawing.Color.Red; alert2.Text = "Only Images files please..."; } if (filee != ".pdf" && filee != ".docs") { alert1.ForeColor = System.Drawing.Color.Red; alert1.Text = "A CV is usuallly a PDF or DOC file..."; } else { // Restrict file size int fileSize = FileUpload1.PostedFile.ContentLength; if (fileSize > 3145728) { alert1.ForeColor = System.Drawing.Color.Red; alert1.Text = "File size exceeded !!!"; } else { FileUpload2.SaveAs(Server.MapPath("~/Savedimages/" + FileUpload2.FileName)); // Show confirmation msg SqlCommand cmd = new SqlCommand("insert into Table1 (Id,nom,prenom,date,sexe,email,datee,niveau,comment,login,password,fileee,img,secteur) values( '" + Id.Text + "','" + nom.Text + "','" + prenom.Text + "' ,'" + date.Text + "' , '" + sexe.Text + "' , '" + email.Text + "' , '" + datee.Text + "' , '" + niveau.Text + "' , '" + comment.Text + "' , '" + login.Text + "' , '" + password.Text + "' , '" + fileee.Text + "' , '" + img.Text + "' , '" + secteur.Text + "')", con); cmd.CommandType = CommandType.Text; try { con.Open(); cmd.ExecuteNonQuery(); succes.Text = "Data Inserted Successfully !"; con.Close(); } catch (Exception ex) { failed.Text = ex.Message; } } } } sendEmail(); }
protected void Button1_Click(object sender, EventArgs e) { FileUpload2.SaveAs(Server.MapPath("~/images1/small/") + FileUpload2.FileName); Image2.ImageUrl = "~/images1/small/" + FileUpload2.FileName; ViewState["img"] = FileUpload2.FileName; TextBox2.Text = FileUpload2.FileName; }
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 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 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 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"; }