The below is code for uploading files to the ftp server but it shows me file not found exception
FileInfo fileInf = new FileInfo(filename);
string uri = "ftp://" + ftpServerIP + path; //+ "/" + fileInf.Name;//
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + path + "/" + filename));//"/" + awb +
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
reqFTP.UseBinary = true;
reqFTP.Proxy = null;
reqFTP.ContentLength = fileInf.Length;
// The buffer size is set to 2kb
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int contentLen;
// Opens a file stream (System.IO.FileStream) to read the file to be uploaded
FileStream fs = fileInf.OpenRead();
// using (FileStream stream = File.Open(@"D:\SSIMFROMFTPServer\", FileMode.Create));
// Stream to which the file to be upload is written
Stream strm = reqFTP.GetRequestStream();
//test
// FileStream writeStream = new FileStream(localDestnDir + "/" + strm, FileMode.Create);
// Read from the file stream 2kb at a time
contentLen = fs.Read(buff, 0, buffLength);
// Till Stream content ends
while (contentLen != 0)
{
// Write Content from the file stream to the FTP Upload Stream
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
}
// Close the file stream and the Request Stream
strm.Close();
fs.Close();