private bool GetFileSize(FileInfo targetFI, long FileUploadedSize, string g_Subdivision,TMWaitDialog tmwaitdialog) { FtpWebRequest reqFTP; long fileSize = 0; try { string Uri = string.Empty; Uri = @"ftp://" + ftpServerIP + "/" + g_Subdivision + "/" + targetFI.Name.ToUpper().Trim(); reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(Uri.Trim())); reqFTP.Method = WebRequestMethods.Ftp.GetFileSize; reqFTP.UseBinary = true; reqFTP.KeepAlive = false; reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword); FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse(); Stream ftpStream = response.GetResponseStream(); fileSize = response.ContentLength; ftpStream.Close(); response.Close(); return (fileSize == FileUploadedSize); } catch (Exception ex) { MessageBox.Show(ex.Message); return false; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)