Esempio n. 1
0
        // sự kiện nhấn nút tạo mới thư mục
        private void button1_Click(object sender, EventArgs e)
        {
            // kiểm tra nếu bỏ trống thì thông báo lỗi
            if (string.IsNullOrEmpty(txtFolder.Text))
            {
                MessageBox.Show("Không được bỏ trống!");
            }
            string folder = txtFolder.Text; // lấy tên thư mục mới

            using (Ftp client = new Ftp())
            {
                // kết nối đến server FTP
                client.Connect(_ip, _port);
                client.Login(_username, _password);

                // thực thi phương thức tạo mới thư mục CreateFolder(tên thư mục tạo mới)
                client.CreateFolder(folder);

                // in câu thông báo
                MessageBox.Show("Đã tạo thư mục tên: " + folder);

                client.Close();
            }
        }