private void skinButton1_Click(object sender, EventArgs e)
{
openFileDialog1.FileName = ""; //对话框初始化
openFileDialog1.ShowDialog();//显示对话框
String total_filename=openFileDialog1.FileName;
String short_filename=openFileDialog1.SafeFileName;
//MessageBox.Show(total_filename);
if (short_filename.ToString() != "")
{
String keyword = Microsoft.VisualBasic.Interaction.InputBox("请输入口令:", "安全验证"); //对输入的口令进行加密运算
string md5_password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(keyword.ToString(), "MD5");
//MessageBox.Show(password);
if (md5_password.ToString() == "16F09AE0A377EDE6206277FAD599F9A0")
{
String url_link = "ftp://*****:*****@133.130.89.177/" + short_filename;
WebClient wc = new WebClient();
wc.UploadProgressChanged += new UploadProgressChangedEventHandler(wc_UploadProgressChanged);
wc.UploadFileCompleted += new UploadFileCompletedEventHandler(wc_UploadFileCompleted);
wc.UploadFileAsync(new Uri(url_link), total_filename);
skinButton1.Enabled = false;
skinButton1.ForeColor = System.Drawing.Color.Black;
//计算用时,计算上传速度
sw.Reset();
sw.Start();
}
else
MessageBox.Show("口令验证失败!");
}
}