locked
How can I upload a file to the FTP server in Winrt possible? RRS feed

  • Question

  • Select an image fromWinrtsent tothe FTP servertries tocreatean app.

    Login and image transferfeature, simply snap.

    Is therea sample or something example??

    Also
    var uploadrer = new BackgroundUploader ();
    uploadrer.ServerCredential = pc;
    var uploadOperation = uploadrer.CreateUpload (new Uri ("ftp:// ...."), file);

    I made a URI that part, but to https with http, FTP, what should I do?

    Winrt you upload a file to the FTP server, Is there a simple example?

    (Note that using C # to develop.)

    Why should not Winrt supported by the FTPWebRequest Why?


    Friday, August 9, 2013 9:06 AM

Answers

  • Hi guenyoung,

    Sorry for the late response. In the document there is a clear word:

    Use the Windows.Networking.BackgroundTransfer APIs provided in the Windows Runtime to enhance your Windows Store app with advanced file download and upload features that run in the background during app suspension, demonstrate per operation lifecycle management, and persist beyond app termination.This feature is ideal for large file downloads and upload operations using the HTTP and HTTPS protocols. FTP is supported, but only when conducting download operations.

    I suggest you can try Download FTP file in Windows Store app sample, this demonstrates how to send FTP commands for downloading. Uploading will be similar by using "STOR" command.

    Best Regards,


    James He
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, August 14, 2013 3:15 AM
    Moderator

All replies

  • Large portions of the System.* API are missing in WinRT simply because they haven't been written yet.

    Writing an FTP client in C# is fairly simple to do. I suggest you Bing "C# FTP client" and use public domain code to get what you need.

    • Marked as answer by guenyoungpark Friday, August 9, 2013 1:09 PM
    • Unmarked as answer by guenyoungpark Friday, August 9, 2013 1:09 PM
    Friday, August 9, 2013 9:16 AM
  • Answer Thank you.

    However, "C # FTP client" search results FTPWebRequest tried entering the commands in the

    You can not use the WinRT.

    I've been looking for hours and can not find FTP Client in Winrt.

    If possible, you made ​​me in Winrt does give us the FTP Client??
    Friday, August 9, 2013 1:09 PM
  • Hi guenyoung,

    Sorry for the late response. In the document there is a clear word:

    Use the Windows.Networking.BackgroundTransfer APIs provided in the Windows Runtime to enhance your Windows Store app with advanced file download and upload features that run in the background during app suspension, demonstrate per operation lifecycle management, and persist beyond app termination.This feature is ideal for large file downloads and upload operations using the HTTP and HTTPS protocols. FTP is supported, but only when conducting download operations.

    I suggest you can try Download FTP file in Windows Store app sample, this demonstrates how to send FTP commands for downloading. Uploading will be similar by using "STOR" command.

    Best Regards,


    James He
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, August 14, 2013 3:15 AM
    Moderator
  • Download, Upload,Delete Files from FTP Server Using C#

    Some time we need to download, upload file from FTP server. Here is some example to FTP operation.

    For this we need to include one namespace and it is. using System.Net

    Here is a good example :http://cybarlab.com/download-upload-files-from-sftp-server-in-c-sharp

    Tuesday, August 27, 2013 5:32 AM
  • Some time we need to download, upload file from FTP server. Here is some good example for FTP operation in C#.
    You can use this.

    Some Good Examples


    Hope it will help you.

    Monday, September 16, 2013 5:49 AM
  • it is a little late but here is a complete sample and write-up that uses the STOR command and sockets in WINRT (http://canbilgin.wordpress.com/2014/03/30/ftp-endeavor-ii-upload-and-download-files/_)

    Can Bilgin
    Blog Samples CompuSight

    Wednesday, April 9, 2014 4:24 PM
  • Hello Guenyoung,

    Try this code:

    private string strFtpAccount;
    private string strFtpPassword;
    private string strFtpDomain;
    
    public ICredentials Credentials
    {
        get
        {
            return new NetworkCredential(strFtpAccount, strFtpPassword, strFtpDomain);
        }
    }

    public async Task UploadFTPFileAsync(Uri destination, StorageFile targetFile) { var request = WebRequest.Create(destination); request.Credentials = Credentials; request.Method = "STOR"; using (var requestStream = (await request.GetRequestStreamAsync())) using (var stream = await targetFile.OpenStreamForReadAsync()) { stream.CopyTo(requestStream); } }

    Regards,

    Richard

    • Proposed as answer by Richard_Bos Wednesday, April 30, 2014 2:46 PM
    Wednesday, April 30, 2014 2:46 PM