示例#1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (button1.Text.Equals("Change"))
     {
         button1.Text                     = "Save";
         flowLayoutPanel1.Visible         = true;
         flowLayoutPanel1.BackgroundImage = null;
         pictureBox1.Visible              = false;
         m_v2.Hide();
         main.Hide();
     }
     else
     {
         if (flowLayoutPanel1.BackgroundImage == null)
         {
             MessageBox.Show("Please input a picture");
             return;
         }
         using (WebClient client = new WebClient())
         {
             client.Headers.Add("Content-Type", "application/octet-stream");
             String s = "http://" + main.db.id + "/fyp_php/uploadImgGet.php?action=image&which=" + fid;
             client.UploadFile(new Uri(s), "POST", @photoPath);
             MessageBox.Show("Updated");
         }
         button1.Text = "Change";
         main.Show();
         m_v2.Show();
     }
 }