当前位置: 首页>>代码示例>>C#>>正文


C# WebClient.UploadDataAsync方法代码示例

本文整理汇总了C#中System.Net.WebClient.UploadDataAsync方法的典型用法代码示例。如果您正苦于以下问题:C# WebClient.UploadDataAsync方法的具体用法?C# WebClient.UploadDataAsync怎么用?C# WebClient.UploadDataAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Net.WebClient的用法示例。


在下文中一共展示了WebClient.UploadDataAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateStationAsync

        public void CreateStationAsync(string musicId)
        {
            try
            {
                WebClient client = new WebClient();
                client.Headers.Add("content-type", "text-xml");
                client.UploadDataCompleted += new UploadDataCompletedEventHandler(CreateStation_UploadDataCompleted);
                Uri uri = new Uri(String.Format(BASE_URL_LID, _rid, _lid, "createStation"));

                List<object> parameters = new List<object>();
                parameters.Add(GetTimestamp());
                parameters.Add(_authenticationToken);
                parameters.Add("mi" + musicId);
                parameters.Add(String.Empty);

                string xml = GetXml("station.createStation", parameters);
                string encryptedXml = EncryptionHelper.EncryptString(xml);
                client.UploadDataAsync(uri, "POST", System.Text.Encoding.ASCII.GetBytes(encryptedXml));
            }
            catch (Exception exception)
            {
                if (ExceptionReceived != null)
                    ExceptionReceived(this, new EventArgs<Exception>(exception));
            }
        }
开发者ID:Justin-Credible,项目名称:Centrafuse-Pandora-Plugin,代码行数:25,代码来源:PandoraClient.cs

示例2: Upload

        public string Upload(string imagePath)
        {
            m_Holder = null;

            GrabbieEngine.Instance.UploadNotificationSystem.UpdateStatus("Uploading", 0);

            var host = PropertyService.Get("Grabbie.FtpUploader.Host");
            var ftpPath = PropertyService.Get("Grabbie.FtpUploader.FtpPath");
            var userName = PropertyService.Get("Grabbie.FtpUploader.UserName");
            var password = PropertyService.Get("Grabbie.FtpUploader.Password");
            var httpPath = PropertyService.Get("Grabbie.FtpUploader.HttpPath");

            var webClient = new WebClient {
                Credentials = new NetworkCredential(userName, password)
            };

            webClient.UploadProgressChanged += webClient_UploadProgressChanged;
            webClient.UploadDataCompleted += webClient_UploadDataCompleted;

            var stream = File.OpenRead(imagePath);
            var buffer = new byte[stream.Length];
            stream.Read(buffer, 0, buffer.Length);
            stream.Close();

            m_Uploading = true;

            webClient.UploadDataAsync(new Uri("ftp://" + host + ftpPath + Path.GetFileName(imagePath)), buffer);

            while (m_Uploading) Thread.Sleep(500);

            if (m_Holder != null)
                throw new WebException("Error during upload: " + m_Holder.Message, m_Holder);

            return httpPath + Path.GetFileName(imagePath);
        }
开发者ID:NasuTek,项目名称:NasuTek-Grabbie,代码行数:35,代码来源:FTPUploader.cs

示例3: Process

        public void Process(Printer printer, string document)
        {
            // https://www.voipbuster.com/myaccount/sendsms.php?username=USERNAME&password=PASS&from=FROM&[email protected]@&[email protected]@
            var settingsObject = GetSettingsObject(printer.CustomPrinterData) as UrlPrinterSettings;
            if (settingsObject == null) return;
            var tokenChar = !string.IsNullOrEmpty(settingsObject.TokenChar) ? settingsObject.TokenChar : "@";
            var url = ReplaceValues(document, settingsObject.UrlFormat, tokenChar);
            if (url.Contains(tokenChar)) return;
            url = Uri.UnescapeDataString(url);

            var data = "";
            if (!string.IsNullOrEmpty(settingsObject.DataFormat))
            {
                data = ReplaceValues(document, settingsObject.DataFormat, tokenChar);
                if (data.Contains(tokenChar)) return;
                data = Uri.UnescapeDataString(data);
            }

            if (settingsObject.LiveMode)
            {
                var c = new WebClient();
                if (!string.IsNullOrEmpty(data))
                {
                    c.UploadDataAsync(new Uri(url), Encoding.GetEncoding(printer.CodePage).GetBytes(data));
                }
                else
                    c.DownloadDataAsync(new Uri(url));
            }
            else MessageBox.Show(url);
        }
开发者ID:GHLabs,项目名称:SambaPOS-3,代码行数:30,代码来源:UrlPrinter.cs

示例4: Notify

 public void Notify(RelaxNotificationMessage relaxNotificationMessage)
 {
     var client = new WebClient();
     client.Headers.Add("Content-Type", "application/json");
     client.UploadDataAsync(new Uri(String.Format("{0}/{1}/{2}", ConfigurationManager.AppSettings["RelaxForTfs.WebServiceApi.BaseUrl"],"api", "messaging")),
                            "POST",
                            System.Text.Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(relaxNotificationMessage)));
 }
开发者ID:ExtraordinaryJerks,项目名称:relax-for-tfs,代码行数:8,代码来源:NotificationService.cs

示例5: Send

 public void Send(string fileName, string content)
 {
     using (var client = new WebClient())
     {
         // client.UploadDataCompleted += UploadDataCompleted;
         byte[] msgBytes = BuildMessage(fileName, content);
         client.UploadDataAsync(loggerApi, "POST", msgBytes, client);
     }
 }
开发者ID:oisy,项目名称:scada,代码行数:9,代码来源:Logger.cs

示例6: GetJson

		private void GetJson(string url, string post, object token)
		{
			var client = new WebClient();
			client.UploadDataCompleted += client_UploadDataCompleted_json;
			client.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko");
			client.Headers.Add("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
			client.Headers.Add("Referer", "http://tool.17mon.cn/ip.php");
			client.Headers.Add("X-Requested-With", "XMLHttpRequest");
			var postString = post;
			var postData = Encoding.Default.GetBytes(postString);
			client.UploadDataAsync(new Uri(url), "POST", postData, token);
			//var srcString = Encoding.Default.GetString(await responseData);
			//return JObject.Parse(srcString);
		}
开发者ID:kevins1022,项目名称:Altman,代码行数:14,代码来源:IPOnlineQuery.cs

示例7: GetHtml

		private void GetHtml(string url, string post, object token)
		{
			var client = new WebClient();
			client.UploadDataCompleted += client_UploadDataCompleted_html;
			//client.Headers.Add("Accept-Language", "zh-CN");
			client.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko");
			client.Headers.Add("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
			client.Headers.Add("Referer", "http://tool.17mon.cn/ip.php");
			var postString = post;
			var postData = Encoding.Default.GetBytes(postString);
			client.UploadDataAsync(new Uri(url), "POST", postData, token);
			//var srcString = Encoding.UTF8.GetString(responseData);
			//return srcString;
		}
开发者ID:kevins1022,项目名称:Altman,代码行数:14,代码来源:IPOnlineQuery.cs

示例8: CreatePackage

        public void CreatePackage(string apiKey, Stream packageStream, IObserver<int> progressObserver, IPackageMetadata metadata = null)
        {
            var state = new PublishState {
                PublishKey = apiKey,
                PackageMetadata = metadata,
                ProgressObserver = progressObserver
            };

            var url = new Uri(String.Format(CultureInfo.InvariantCulture, "{0}/{1}/{2}/nupkg", _baseGalleryServerUrl, CreatePackageService, apiKey));

            WebClient client = new WebClient();
            client.Proxy = _cachedProxy;
            client.Headers[HttpRequestHeader.ContentType] = "application/octet-stream";
            client.Headers[HttpRequestHeader.UserAgent] = _userAgent;
            client.UploadProgressChanged += OnUploadProgressChanged;
            client.UploadDataCompleted += OnCreatePackageCompleted;
            client.UploadDataAsync(url, "POST", packageStream.ReadAllBytes(), state);
        }
开发者ID:jacksonh,项目名称:nuget,代码行数:18,代码来源:GalleryServer.cs

示例9: AsyncSendRequest

        public static void AsyncSendRequest(string url, string postData)
        {
            var webClient = new WebClient();
            webClient.Encoding = Encoding.GetEncoding(REQUEST_ENCODING);
            webClient.Headers.Add("Content-Type", CONTENT_TYPE);
            webClient.Headers.Add("User-Agent", USER_AGENT);
            //webClient.Headers.Add("Content-Length", postData.Length.ToString());

            byte[] sendData = Encoding.GetEncoding(REQUEST_ENCODING).GetBytes(postData);
            webClient.UploadDataAsync(new Uri(url), "POST", sendData);

            webClient.UploadDataCompleted += (sender, args) =>
                                                 {

                                                     if (_firstRequestTime == DateTime.MinValue)
                                                         _firstRequestTime = DateTime.Now;
                                                     _lastRequestTime = DateTime.Now;
                                                     _requestCounts++;
                                                     Console.WriteLine(CaculateSpentTime());
                                                 };
        }
开发者ID:kevindwf,项目名称:PerformanceTestLoader,代码行数:21,代码来源:AsyncWebClientRequestHelper.cs

示例10: UploadDocumentAsync

        public void UploadDocumentAsync(string fileUpArchivo, string remoteFile)
        {
            // Leemos el archivo
            FileStream fs = new FileStream(fileUpArchivo, FileMode.Open, FileAccess.Read);
            byte[] buffer = new byte[fs.Length];
            fs.Read(buffer, 0, Convert.ToInt32(fs.Length));
            fs.Close();

            //Subimos el archivo de manera asíncrona
            WebClient wc = new WebClient();
            wc.Credentials = System.Net.CredentialCache.DefaultCredentials;

            //Manejador de evento para obtener información sobre el progreso
            wc.UploadProgressChanged += new UploadProgressChangedEventHandler(UploadProgressChanged);
            //Manejador de evento para saber cuando se completo la subida del archivo
            wc.UploadDataCompleted += new UploadDataCompletedEventHandler(UploadDataCompleted);
            //Iniciamos la subida del archivo asincronamente
            wc.UploadDataAsync(new Uri(remoteFile), "PUT", buffer);
            //Podriamos cancelar la carga del archivo
            //wc.CancelAsync();
        }
开发者ID:gcode-mirror,项目名称:chafam,代码行数:21,代码来源:UploadFiles.cs

示例11: UploadImage

        void UploadImage(BitmapSource img_wpf)
        {
            System.Drawing.Image img = ImageWpfToGDI(img_wpf);
            string UID = Guid.NewGuid().ToString().Replace("-", "");
            int lastprogress = 0;

            MemoryStream ImageStream = new MemoryStream();
            img.Save(ImageStream, System.Drawing.Imaging.ImageFormat.Png);

            byte[] image = BlazeGames.IM.Client.Core.Utilities.Compress(ImageStream.ToArray());
            if (image.Length > 10485760)
            {
                NotificationWindow.ShowNotification("Upload Failed", "The image you are trying to upload is larger than 10MB when compressed.");
                return;
            }

            HandleMessage(App.FullName, @"<Span xmlns=""default"">
            <Grid Name=""upload_" + UID + @"_control"" Background=""Transparent"" Width=""400"" Height=""100"">
            <Grid.ColumnDefinitions>
            <ColumnDefinition Width=""100""/>
            <ColumnDefinition Width=""*""/>
            </Grid.ColumnDefinitions>
            <ProgressBar Name=""upload_" + UID + @"_progress"" HorizontalAlignment=""Stretch"" Height=""20"" Margin=""15,42,15,15"" VerticalAlignment=""Center"" Grid.Column=""1""/>
            <Image Name=""upload_" + UID + @"_thumbnail"" Grid.Column=""0"" HorizontalAlignment=""Stretch"" Margin=""15"" VerticalAlignment=""Stretch""/>
            <Label Name=""upload_" + UID + @"_filename"" Content=""UploadedImage.png"" Grid.Column=""1"" Margin=""15,15,15,40"" VerticalAlignment=""Center"" FontSize=""18"" Foreground=""#FF363636""  />
            <Label Name=""upload_" + UID + @"_progresstxt"" Content=""Uploading (0%)..."" Grid.Column=""1"" Margin=""15,42,15,15"" VerticalAlignment=""Center"" FontSize=""14"" Foreground=""#FF5F5F5F""  />
            </Grid>
            <LineBreak />
            </Span>");
            UpdateUploadThumbnail(UID, img_wpf);

            using (WebClient wc = new WebClient())
            {
                Uploads.Add(UID);

                wc.UploadDataCompleted += (sender, e) =>
                    {
                        Uploads.Remove(UID);
                        string Url = Encoding.Default.GetString(e.Result);
                        UpdateUploadComplete(UID, Url);

                        ChattingWith.SendMessage(@"<Span xmlns=""default"">
            <Grid Name=""upload_" + UID + @"_control"" Cursor=""Hand"" Background=""Transparent"" Width=""400"" Height=""100"" Tag=""" + Url + @""">
            <Grid.ColumnDefinitions>
            <ColumnDefinition Width=""100""/>
            <ColumnDefinition Width=""*""/>
            </Grid.ColumnDefinitions>
            <Image Name=""upload_" + UID + @"_thumbnail"" Grid.Column=""0"" HorizontalAlignment=""Stretch"" Margin=""15"" VerticalAlignment=""Stretch"" Source=""" + Url + @"""/>
            <Label Name=""upload_" + UID + @"_filename"" Content=""UploadedImage.png"" Grid.Column=""1"" Margin=""15,15,15,40"" VerticalAlignment=""Center"" FontSize=""18"" Foreground=""#FF363636""  />
            <Label Name=""upload_" + UID + @"_progresstxt"" Content=""" + Url + @""" Grid.Column=""1"" Margin=""15,42,15,15"" VerticalAlignment=""Center"" FontSize=""14"" Foreground=""#FF5F5F5F""  />
            </Grid>
            <LineBreak />
            </Span>");
                    };

                wc.UploadProgressChanged += (sender, e) =>
                    {

                        if (lastprogress != e.ProgressPercentage)
                        {
                            UpdateUploadProgress(UID, (e.ProgressPercentage * 2) - 1);
                        }

                        lastprogress = e.ProgressPercentage;
                    };

                wc.UploadDataAsync(new Uri("http://blaze-games.com/files/upload/&file_name=UploadedImage.png"), image);
            }
        }
开发者ID:astorks,项目名称:BlazeIM,代码行数:69,代码来源:page_chat.xaml.cs

示例12: rtf_DragDrop

        private void rtf_DragDrop(object s, DragEventArgs ev)
        {
            if (ev.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] docPath = (string[])ev.Data.GetData(DataFormats.FileDrop);
                foreach (string file in docPath)
                {
                    FileInfo fi = new FileInfo(file);
                    if(!fi.Exists)
                        continue;

                    bool IsImage = (fi.Extension == ".png" || fi.Extension == ".jpg" || fi.Extension == ".gif");

                    string icon = "http://blaze-games.com/files/icon/file-" + fi.Name + "/";

                    string UID = Guid.NewGuid().ToString().Replace("-", "");
                    int lastprogress = 0;
                    byte[] DeCompressedFileData = File.ReadAllBytes(fi.FullName);
                    byte[] filedata = BlazeGames.IM.Client.Core.Utilities.Compress(DeCompressedFileData);

                    if(filedata.Length >= 10485760)
                    {
                        NotificationWindow.ShowNotification("Upload Failed", "The file " + fi.Name + " is larger than 10MB when compressed.");
                        return;
                    }

                    HandleMessage(App.FullName, @"<Span xmlns=""default"">
            <Grid Name=""upload_" + UID + @"_control"" Background=""Transparent"" Width=""400"" Height=""100"">
            <Grid.ColumnDefinitions>
            <ColumnDefinition Width=""100""/>
            <ColumnDefinition Width=""*""/>
            </Grid.ColumnDefinitions>
            <ProgressBar Name=""upload_" + UID + @"_progress"" HorizontalAlignment=""Stretch"" Height=""20"" Margin=""15,42,15,15"" VerticalAlignment=""Center"" Grid.Column=""1""/>
            <Image Name=""upload_" + UID + @"_thumbnail"" Grid.Column=""0"" HorizontalAlignment=""Stretch"" Margin=""15"" VerticalAlignment=""Stretch""/>
            <Label Name=""upload_" + UID + @"_filename"" Content=""" + fi.Name + @""" Grid.Column=""1"" Margin=""15,15,15,40"" VerticalAlignment=""Center"" FontSize=""18"" Foreground=""#FF363636""  />
            <Label Name=""upload_" + UID + @"_progresstxt"" Content=""Uploading (0%)..."" Grid.Column=""1"" Margin=""15,42,15,15"" VerticalAlignment=""Center"" FontSize=""14"" Foreground=""#FF5F5F5F""  />
            </Grid>
            <LineBreak />
            </Span>");
                    if(IsImage)
                        UpdateUploadThumbnail(UID, new System.Windows.Media.Imaging.BitmapImage(new Uri(fi.FullName)));
                    else
                        UpdateUploadThumbnail(UID, new System.Windows.Media.Imaging.BitmapImage(new Uri(icon)));

                    using (WebClient wc = new WebClient())
                    {
                        Uploads.Add(UID);

                        wc.UploadDataCompleted += (sender, e) =>
                        {
                            Uploads.Remove(UID);
                            string Url = Encoding.Default.GetString(e.Result);
                            UpdateUploadComplete(UID, Url);

                            if (IsImage)
                                icon = Url;

                            ChattingWith.SendMessage(@"<Span xmlns=""default"">
            <Grid Name=""upload_" + UID + @"_control"" Cursor=""Hand"" Background=""Transparent"" Width=""400"" Height=""100"" Tag=""" + Url + @""">
            <Grid.ColumnDefinitions>
            <ColumnDefinition Width=""100""/>
            <ColumnDefinition Width=""*""/>
            </Grid.ColumnDefinitions>
            <Image Name=""upload_" + UID + @"_thumbnail"" Grid.Column=""0"" HorizontalAlignment=""Stretch"" Margin=""15"" VerticalAlignment=""Stretch"" Source=""" + icon + @"""/>
            <Label Name=""upload_" + UID + @"_filename"" Content=""" + fi.Name + @""" Grid.Column=""1"" Margin=""15,15,15,40"" VerticalAlignment=""Center"" FontSize=""18"" Foreground=""#FF363636""  />
            <Label Name=""upload_" + UID + @"_progresstxt"" Content=""" + Url + @""" Grid.Column=""1"" Margin=""15,42,15,15"" VerticalAlignment=""Center"" FontSize=""14"" Foreground=""#FF5F5F5F""  />
            </Grid>
            <LineBreak />
            </Span>");
                        };

                        wc.UploadProgressChanged += (sender, e) =>
                        {

                            if (lastprogress != e.ProgressPercentage)
                            {
                                UpdateUploadProgress(UID, (e.ProgressPercentage * 2) - 1);
                            }

                            lastprogress = e.ProgressPercentage;
                        };

                        wc.UploadDataAsync(new Uri("http://blaze-games.com/files/upload/&file_name=" + fi.Name), filedata);
                    }
                }
            }

            ev.Handled = false;
        }
开发者ID:astorks,项目名称:BlazeIM,代码行数:89,代码来源:page_chat.xaml.cs

示例13: Send

        private void Send(string api, Packet packet, DateTime time)
        {
            try
            {
                Uri uri = new Uri(this.GetUrl(api));
                byte[] data = Encoding.ASCII.GetBytes(packet.ToString());
                WebClient wc = new WebClient();
                wc.UploadDataCompleted += (object sender, UploadDataCompletedEventArgs e) =>
                    {
                        if (e.Error != null)
                        {
                            return;
                        }
                        Packet p = (Packet)e.UserState;
                        if (p != null)
                        {
                            string result = Encoding.ASCII.GetString(e.Result);
                            // TODO: with result
                        }

                    };
                wc.UploadDataAsync(uri, Post, data, packet);

            }
            catch (Exception e)
            {

            }
        }
开发者ID:mrddos,项目名称:planisphere,代码行数:29,代码来源:Agent.cs

示例14: SyncAsync

 private void SyncAsync()
 {
     try
     {
         WebClient client = new WebClient();
         client.Headers.Add("content-type", "text-xml");
         client.UploadDataCompleted += new UploadDataCompletedEventHandler(Sync_UploadDataCompleted);
         Uri uri = new Uri(String.Format(BASE_URL_RID, _rid, "sync"));
         string xml = GetXml("misc.sync", null);
         string encryptedXml = EncryptionHelper.EncryptString(xml);
         client.UploadDataAsync(uri, "POST", System.Text.Encoding.ASCII.GetBytes(encryptedXml));
     }
     catch (Exception exception)
     {
         if (ExceptionReceived != null)
             ExceptionReceived(this, new EventArgs<Exception>(exception));
     }
 }
开发者ID:Justin-Credible,项目名称:Centrafuse-Pandora-Plugin,代码行数:18,代码来源:PandoraClient.cs

示例15: device_ImageReady

        // 撮影画像の準備完了時のイベントメソッド:撮影画像を保存し、保存完了時に【writeImgFileCallback】Hubを呼び出す。
        void device_ImageReady(NikonDevice sender, NikonImage image)
        {
            using (MemoryStream memStream = new MemoryStream(image.Buffer)) {
                // 画像データの検証オン
                _PhotImg = System.Drawing.Image.FromStream(memStream);

                //保存する写真画像のユーニークなファイル名
                //確認用に、フォームに撮った写真をフォームに表示
                picBoxPhotImage.Image = _PhotImg;

                //写真画像保存時のファイル名にユニークな名前を付ける。
                string fileUnqNm = "phot" + DateTime.Now.Month.ToString() + "_" + DateTime.Now.Day.ToString() + "_" + DateTime.Now.Hour.ToString() + "_" + DateTime.Now.Minute.ToString() + "_" + DateTime.Now.Second.ToString() + "_" + DateTime.Now.Millisecond.ToString() + ".jpg";

                #region 条件分岐:ローカルサーバへのファイル保存がONなら
                if (chkBxFileSave.Checked == true) {
                    try {//ファイル保存
                        Console.WriteLine("写真画像保存開始");

                        //flStream.BeginWriteイベントハンド呼び出し時に使用するステイタスパラメータクラスのインスタンスを作成
                        using (EvHndParamClass param = new EvHndParamClass()) {

                            // ファイル書き込み終了時のイベントハンドラで実行されるコールバックメソッド内でファイル名を利用すため
                            //そのイベントハンドラに渡すパラメータの、stプロパティにファイル名をセット
                            param.str = fileUnqNm;

                            //非同期書き込み用のファイルストリームを作成
                            using (FileStream flStream = new FileStream(@"C:\inetpub\wwwroot\images/" + fileUnqNm, FileMode.Create,
                                                                        FileAccess.Write, FileShare.ReadWrite, image.Buffer.Length, true)) {
                                //非同期書き込み、書き込み終了時に呼び出されるメソッド【writeFileCallback】
                                //flStream.BeginWrite(image.Buffer, 0, image.Buffer.Length, new AsyncCallback(writeImgFileCallback), flStream);
                                flStream.BeginWrite(image.Buffer, 0, image.Buffer.Length, new AsyncCallback(writeImgFileCallback), param);
                                //							await writer.WriteAsync(input);
                            }
                        }
                    } catch (Exception ex) {
                        Console.WriteLine("err:" + ex.Message + " 写真画像ファイル書き込み失敗!");
                    }
                }
                #endregion

                #region 条件分岐: FTPアップロードチェックボックスがONなら
                if (chkBxFtpUpLoad.Checked == true) {
                    try {//↓は、FTPにて写真アップロードの【場合】です。
                        WebClient wc = new WebClient();
                        //アップロード完了時イベントを登録
                        wc.UploadDataCompleted += (s, e) => {
                            Console.WriteLine("アップロード完了");
                            _HubProxy.Invoke("PhotChange", fileUnqNm).Wait();
                        };

                        //Uri u = new Uri("" + fileUnqNm);
                        Uri u = new Uri("ftp://waws-prod-os1-001.ftp.azurewebsites.windows.net/site/wwwroot/images/" + fileUnqNm);

                        //認証設定
            //						wc.Credentials = new NetworkCredential(@"", "");
                        wc.Credentials = new NetworkCredential(@"picUpSignalR\$picUpSignalR", FtpCredentials);

                        Console.WriteLine("写真画像FTPアップロード開始");
                        wc.UploadDataAsync(u, image.Buffer);
                    } catch (Exception ex) {
                        //MessageBox.Show(ex.ToString());
                        Console.WriteLine("err:" + ex.Message + " 写真画像FTPアップロード失敗!");
                    }
                }
                #endregion
            }
        }
开发者ID:osamu3,项目名称:tackPic,代码行数:68,代码来源:Form1.cs


注:本文中的System.Net.WebClient.UploadDataAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。