1

I am trying to get my UWP app to send a small text file to my ftp server but all the code snippets I have looked at don`t seem to work with UWP apps.

Here is the code I have tried using from the following link :

upload file to ftp site using vb.net

I am using Visual studio 2015 community and it doesn`t recognise the FTPWebRequest method.

I have also looked at the BackgroundTransfer sample from the following link :

https://github.com/Microsoft/Windows-universal-samples

But when I run it and enter my FTP server address in the form

ftp://IPAddress/TestFolder/

and attach a simple text file it gives me an error at the line :

Dim upload As UploadOperation = uploader.CreateUpload(uri, file)

as The parameter is incorrect.

I can`t seem to find anything else to help with a UWP app as all the sites and forums I have looked at all seem to have similar code to the first link.

I can access the Ftp site through windows explorer on my laptop and drag and drop files that way so I know the site is accessible.

Not sure if there is a reference I am missing, I have the Internet(client) and Internet(client and Server) enabled in the appxmanifest.

Community
  • 1
  • 1
Gazza
  • 95
  • 2
  • 9
  • Possible duplicate of [C# Ftp Upload in Windows 10 Universal app?](http://stackoverflow.com/questions/32380715/c-sharp-ftp-upload-in-windows-10-universal-app) – Martin Prikryl Jul 22 '16 at 13:31

2 Answers2

1

From MSDN:

Download operations via FTP are supported. However, for FTP operations, authentication credentials must be provided within the specified URI. For example, ftp://user:password@server/file.txt

BackgroundDownloader class

Alexej Sommer
  • 2,677
  • 1
  • 14
  • 25
0

Thanks for the replies.

I decided to use a package from https://www.chilkatsoft.com/ftp-2-dotnet.asp. which is available as a nuget package.

With a few lines of code I was able to upload a file using ftp with no problems.

Gazza
  • 95
  • 2
  • 9