c# FTP上传问题
来源:百度知道 编辑:UC知道 时间:2024/06/11 13:37:40
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//浏览文件
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog MyDlg = new OpenFileDialog();
MyDlg.CheckFileExists = true;
if (MyDlg.ShowDialog() == DialogResult.OK)
{
this.textBox1.Text = MyDlg.FileName;
}
}
//上传文件
private void button2_Click(object sender, EventArgs e)
{
string MyFile = this.textBox1.Text;
if (!System.IO.File.Exists(MyFile))
{
MessageBox.Show(MyFile + "文件不存在!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
try
{