日期:2014-05-17  浏览次数:20871 次

ftp技术多线程上传图片
我现在想做一个winfrom ,想利用ftp技术进行多线程的上传图片,而且还有进度条显示!请哪个大侠能指点一下,给个例子,谢谢!

------解决方案--------------------
只要开一个上传的线程就行了,只要不卡住UI就可以了

类似这样的代码
Thread t = new Thread(workThreadFunc);
t.Start();
------解决方案--------------------
backgroundwork
------解决方案--------------------
C# code

bw = new BackgroundWorker();
                                            bw.WorkerReportsProgress = true;
                                            bw.DoWork += new DoWorkEventHandler(bw_DoWork);
                                            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
                                            bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
                                            bw.RunWorkerAsync(temp);
private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            ftp 下载
        }

------解决方案--------------------
比如用webclient

C# code

        WebClient wc = new WebClient();
        byte[] data = new byte[10];
        wc.UploadDataCompleted += new UploadDataCompletedEventHandler(wc_UploadDataCompleted);
        wc.UploadDataAsync(new Uri("http://www.sina.com.cn"), data);