# Region ftp upload function
/// <Summary>
/// Ftp upload function
/// </Summary>
/// <Param name = "ftpServerIP"> </param>
/// <Param name = "filename"> </param>
/// <Param name = "ftpUserID"> </param>
/// <Param name = "ftpPassword"> </param>
Public static void Upload (string ftpServerIP, string filename, string ftpUserID, string ftpPassword)
{
FileInfo fileInf = new FileInfo (filename );
String uri = "ftp: //" + ftpServerIP + "/" + fileInf. Name;
FtpWebRequest reqFTP;
// Create an FtpWebRequest object based on the uri
ReqFTP = (FtpWebRequest) FtpWebRequest. Create (new Uri ("ftp: //" + ftpServerIP + "/" + fileInf. Name ));
// Ftp user name and password
ReqFTP. Credentials = new NetworkCredential (ftpUserID, ftpPassword );
// The default value is true, and the connection will not be closed
// Executed after a command
ReqFTP. KeepAlive = false;
// Specify the command to be executed
ReqFTP. Method = WebRequestMethods. Ftp. UploadFile;
// Specify the data transmission type
ReqFTP. UseBinary = true;
// Notify the server of the file size when uploading the file
ReqFTP. ContentLength = fileInf. Length;
// Set the buffer size to 2 kb.