System.Net.WebClient.UploadFileAsync C# (CSharp) Method

UploadFileAsync() public method

public UploadFileAsync ( System address, string fileName ) : void
address System
fileName string
return void
        public void UploadFileAsync(System.Uri address, string fileName) { }
        public void UploadFileAsync(System.Uri address, string method, string fileName) { }

Same methods

WebClient::UploadFileAsync ( System address, string method, string fileName ) : void
WebClient::UploadFileAsync ( System address, string method, string fileName, object userToken ) : void

Usage Example

Esempio n. 1
0
        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("口令验证失败!");
            }
        }
All Usage Examples Of System.Net.WebClient::UploadFileAsync