从blob存储上传文件到ftp。 [英] Upload file to ftp from blob storage.

查看:336
本文介绍了从blob存储上传文件到ftp。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的文件存储在azure blob中。现在我想直接将文件从blob传输到ftp服务器。



i试过这个。

i have files stored at azure blob. Now i want to transfer file directly form blob to ftp server.

i have tried this.

string ftpfullpath = @"ftp://myftp.com/Test.xml";
                
                
                FtpWebRequest ftp = WebRequest.Create(ftpfullpath) as FtpWebRequest;
                if (ftp != null)
                {
                    ftp.Credentials = new NetworkCredential("uname", "pass");

                    ftp.KeepAlive = false;
                    ftp.UseBinary = true;
                    ftp.Method = WebRequestMethods.Ftp.UploadFile;
                }

                FileStream fs = File.OpenRead(blobfilePath.Replace("https","http"));
                byte[] buffer = new byte[fs.Length];
                fs.Read(buffer, 0, buffer.Length);
                fs.Close();

                Stream ftpstream = ftp.GetRequestStream();
                ftpstream.Write(buffer, 0, buffer.Length);
                ftpstream.Close();



但我收到错误''URI格式不受支持''。



我怎样才能实现这个目标..



提前谢谢。


But am am getting an error ''URI formats are not supported''.

how can i achieve this..

Thanks in advance.

推荐答案

非常欢迎你,只是回答这里,这样就不会出现在没有问题的问题上。
you''re most welcome, Just answering here so that it''s not appearing in unswanred questions.


这篇关于从blob存储上传文件到ftp。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆