Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何从给定的图像路径(实时URL)直接将图像上载到FTP_C#_Asp.net_Xml - Fatal编程技术网

C# 如何从给定的图像路径(实时URL)直接将图像上载到FTP

C# 如何从给定的图像路径(实时URL)直接将图像上载到FTP,c#,asp.net,xml,C#,Asp.net,Xml,我正在做的任务,我需要上传图像到特定的FTP使用C编码从给定的实时路径 目前我已经完成了,但要在FTP上上传图片,我需要来回下载图片 然后使用代码将其上传到live 我想要的解决方案,直接上传图像到ftp,而不下载它 从给定的路径开始 我需要上传这个图像 您好,我正在进一步纠正我的问题,我想从这个URLglobalgear.com.au/productfeed.xml获取大小图像,并直接上传到FTP,而无需在本地下载 请提出解决方案 谢谢 Chetan也许这会起作用: // Get the o

我正在做的任务,我需要上传图像到特定的FTP使用C编码从给定的实时路径

目前我已经完成了,但要在FTP上上传图片,我需要来回下载图片 然后使用代码将其上传到live

我想要的解决方案,直接上传图像到ftp,而不下载它

从给定的路径开始

我需要上传这个图像


您好,我正在进一步纠正我的问题,我想从这个URLglobalgear.com.au/productfeed.xml获取大小图像,并直接上传到FTP,而无需在本地下载

请提出解决方案

谢谢
Chetan

也许这会起作用:

 // Get the object used to communicate with the server.
    FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://www.contoso.com/test.htm");
    request.Method = WebRequestMethods.Ftp.UploadFile;

    // This example assumes the FTP site uses anonymous logon.
    request.Credentials = new NetworkCredential ("anonymous","janeDoe@contoso.com");

    // Copy the contents of the file to the request stream.
    StreamReader sourceStream = new StreamReader("testfile.txt");
    byte [] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
    sourceStream.Close();
    request.ContentLength = fileContents.Length;

    Stream requestStream = request.GetRequestStream();
    requestStream.Write(fileContents, 0, fileContents.Length);
    requestStream.Close();

    FtpWebResponse response = (FtpWebResponse)request.GetResponse();

    Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription);

    response.Close();

您好,我正在修正我的问题更多,我想从这个URL获取大小图像,并直接上传到FTP,而无需在本地下载它。