Saber Shaikh

Saber Shaikh

  • 760
  • 1.2k
  • 135.5k

How to Upload image file on Ftp server in C#

Dec 22 2014 2:25 AM
Error Is 


The remote server returned an error: (530) Not logged in. c#


So Please Help Me




i write this Code but Not Working Face Error 


private void uploadFile(string FTPAddress, string filePath, string username, string password)
        {
            //Create FTP request
            FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(FTPAddress + "/" + Path.GetFileName(filePath));


            request.Method = WebRequestMethods.Ftp.UploadFile;
            request.Credentials = new NetworkCredential(username, password);
            request.UsePassive = true;
            request.UseBinary = true;
            request.KeepAlive = false;


            //Load the file
            FileStream stream = File.OpenRead(filePath);
            byte[] buffer = new byte[stream.Length];


            stream.Read(buffer, 0, buffer.Length);
            stream.Close();


            //Upload file
            Stream reqStream = request.GetRequestStream();
            reqStream.Write(buffer, 0, buffer.Length);
            reqStream.Close();


            MessageBox.Show("Uploaded Successfully");
        }



Help Me Fast
Tahnk You

Blog: http://aspnettutorialscode.blogspot.in/