using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
namespace Wind1
{
    public partial class Form1 : Form
    {
        string fileName = "";
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
        }
        
        private void button1_Click_1(object sender, EventArgs e)
        {
            string path = "";
            OpenFileDialog fDialog = new OpenFileDialog();
            fDialog.Title = "Attach customer proposal document";
            fDialog.Filter = "Doc Files|*.doc|Docx File|*.docx|PDF doc|*.pdf";
            fDialog.InitialDirectory = @"C:\";
            if (fDialog.ShowDialog() == DialogResult.OK)
            {
                fileName = System.IO.Path.GetFileName(fDialog.FileName);
                path = Path.GetDirectoryName(fDialog.FileName);
                textBox1.Text = path + "\\" + fileName;
            }
        }
        private void button2_Click_1(object sender, EventArgs e)
        {
            try
            {
                WebClient client = new WebClient();
                NetworkCredential nc = new NetworkCredential("arcs360", "arcs");
                Uri addy = new Uri(@"\\10.255.1.147\Styles\" + fileName);
                client.Credentials = nc;
                byte[] arrReturn = client.UploadFile(addy,textBox1.Text);
                MessageBox.Show(arrReturn.ToString());
            }
            catch (Exception ex1)
            {
                MessageBox.Show(ex1.Message);
            }
        }
    }
}