I have some trouble with uploading file to ftp server

I have trouble with uploading file to my ftp server in my Android device, in Editor it working perfect. Plz help me with it !!!

try
              {
                  string filename = Path.GetFileName(/* local file path */);

                  FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(/ link to file in my server */);
                  ftp.Credentials = new NetworkCredential(username_ftp, password_ftp);

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

                  FileStream fs = File.OpenRead(/* local file  path */);
                  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();
              }
              catch (Exception ex)
              {
                  throw ex;
              }

I’m not really sure what you’re asking… What’s the problem?

it just work fine on development build and when you build release ftp request don’t have connection.

Hi,

Sorry for late reply.
You can try this @trantnt1093
Use FtpWebRequest.Open instead of FtpWebRequest.Create.