Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

FTP MakeDirectory Issues

$
0
0

I'm developing an application for a company I work for. It's supposed to upload photos taken on an Android or iOS device to an FTP server. I'm using Xamarin.Forms for the iOS and the Android version of the app. I also have a UWP version of the app, using Xamarin, but not Xamarin Forms. That version of the app uses the exact same FTP code as the Android and iOS versions and it works. But the Android and iOS versions don't work.

The Android and iOS keep getting 550 (no such file exists error). Yet, I'm not trying to locate a file or directory, I'm trying to make it..

        string currentDir = "ftp://10.1.0.1:21/IMGS/EQUIPS/";
        string[] subDirs = result.EntireDirectory.Replace("//", "/").Split('/');

        // Make directories.
        foreach (string subDir in subDirs)
        {
            try
            {
                currentDir += subDir + "/";

                if (DirectoryExists(currentDir) == false)
                {
                    request = (FtpWebRequest)FtpWebRequest.Create(currentDir);
                    request.Method = "MKD";
                    request.Credentials = new NetworkCredential("USERNAME", "PASSWORD");
                    response = (FtpWebResponse)request.GetResponse();
                    stream = response.GetResponseStream();
                    stream.Close();
                    response.Close();
                }
            }
            catch (WebException ex)
            {
                String status = ((FtpWebResponse)ex.Response).StatusDescription;

                if (DirectoryExists(currentDir) == false)
                {
                    JobError("Cannot Connect");
                    return;
                }
           }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>