我的编程空间,编程开发者的网络收藏夹
学习永远不晚

基于C#实现FTP下载文件

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

基于C#实现FTP下载文件

实践过程

效果

代码

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(textBox1.Text);
            ftpRequest.Credentials = new NetworkCredential(textBox2.Text,textBox3.Text);
            FtpWebResponse ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
            Stream data = ftpResponse.GetResponseStream();
            string str = textBox1.Text.Substring(textBox1.Text.LastIndexOf("/"), textBox1.Text.Length - textBox1.Text.LastIndexOf("/"));
            string SavePath = str;
            if (File.Exists(SavePath))
            {
                File.Delete(str);
            }
            byte[] buffer = new byte[4096];
            FileStream stream  =new FileStream(SavePath,FileMode.Create);
            int count = 0;
            do
            {
                count = data.Read(buffer, 0, buffer.Length);
                if (count > 0)
                {
                    stream.Write(buffer, 0, count);
                }
            }
            while (count > 0);
            ftpResponse.Close();
            stream.Close();
        }
    }
partial class Form1
{
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows 窗体设计器生成的代码

    /// <summary>
    /// 设计器支持所需的方法 - 不要
    /// 使用代码编辑器修改此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
        this.button1 = new System.Windows.Forms.Button();
        this.textBox1 = new System.Windows.Forms.TextBox();
        this.label1 = new System.Windows.Forms.Label();
        this.label2 = new System.Windows.Forms.Label();
        this.textBox2 = new System.Windows.Forms.TextBox();
        this.label3 = new System.Windows.Forms.Label();
        this.textBox3 = new System.Windows.Forms.TextBox();
        this.toolStrip1 = new System.Windows.Forms.ToolStrip();
        this.新建NToolStripButton = new System.Windows.Forms.ToolStripButton();
        this.打开OToolStripButton = new System.Windows.Forms.ToolStripButton();
        this.保存SToolStripButton = new System.Windows.Forms.ToolStripButton();
        this.打印PToolStripButton = new System.Windows.Forms.ToolStripButton();
        this.toolStripSeparator = new System.Windows.Forms.ToolStripSeparator();
        this.剪切UToolStripButton = new System.Windows.Forms.ToolStripButton();
        this.复制CToolStripButton = new System.Windows.Forms.ToolStripButton();
        this.粘贴PToolStripButton = new System.Windows.Forms.ToolStripButton();
        this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
        this.帮助LToolStripButton = new System.Windows.Forms.ToolStripButton();
        this.menuStrip1 = new System.Windows.Forms.MenuStrip();
        this.文件FToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.新建NToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.打开OToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
        this.保存SToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.另存为AToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
        this.打印PToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.打印预览VToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
        this.退出XToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.编辑EToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.撤消UToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.重复RToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
        this.剪切TToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.复制CToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.粘贴PToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
        this.全选AToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.工具TToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.自定义CToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.选项OToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.帮助HToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.内容CToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.索引IToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.搜索SToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
        this.关于AToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
        this.toolStrip1.SuspendLayout();
        this.menuStrip1.SuspendLayout();
        this.SuspendLayout();
        // 
        // button1
        // 
        this.button1.Location = new System.Drawing.Point(178, 162);
        this.button1.Name = "button1";
        this.button1.Size = new System.Drawing.Size(75, 23);
        this.button1.TabIndex = 0;
        this.button1.Text = "下载";
        this.button1.UseVisualStyleBackColor = true;
        this.button1.Click += new System.EventHandler(this.button1_Click);
        // 
        // textBox1
        // 
        this.textBox1.Location = new System.Drawing.Point(108, 76);
        this.textBox1.Name = "textBox1";
        this.textBox1.Size = new System.Drawing.Size(145, 21);
        this.textBox1.TabIndex = 1;
        // 
        // label1
        // 
        this.label1.AutoSize = true;
        this.label1.Location = new System.Drawing.Point(21, 79);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(83, 12);
        this.label1.TabIndex = 2;
        this.label1.Text = "FTP服务器路径";
        // 
        // label2
        // 
        this.label2.AutoSize = true;
        this.label2.Location = new System.Drawing.Point(7, 106);
        this.label2.Name = "label2";
        this.label2.Size = new System.Drawing.Size(95, 12);
        this.label2.TabIndex = 4;
        this.label2.Text = "FTP服务器用户名";
        // 
        // textBox2
        // 
        this.textBox2.Location = new System.Drawing.Point(108, 103);
        this.textBox2.Name = "textBox2";
        this.textBox2.Size = new System.Drawing.Size(145, 21);
        this.textBox2.TabIndex = 3;
        // 
        // label3
        // 
        this.label3.AutoSize = true;
        this.label3.Location = new System.Drawing.Point(21, 133);
        this.label3.Name = "label3";
        this.label3.Size = new System.Drawing.Size(83, 12);
        this.label3.TabIndex = 6;
        this.label3.Text = "FTP服务器密码";
        // 
        // textBox3
        // 
        this.textBox3.Location = new System.Drawing.Point(108, 130);
        this.textBox3.Name = "textBox3";
        this.textBox3.Size = new System.Drawing.Size(145, 21);
        this.textBox3.TabIndex = 5;
        // 
        // toolStrip1
        // 
        this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
        this.新建NToolStripButton,
        this.打开OToolStripButton,
        this.保存SToolStripButton,
        this.打印PToolStripButton,
        this.toolStripSeparator,
        this.剪切UToolStripButton,
        this.复制CToolStripButton,
        this.粘贴PToolStripButton,
        this.toolStripSeparator1,
        this.帮助LToolStripButton});
        this.toolStrip1.Location = new System.Drawing.Point(0, 24);
        this.toolStrip1.Name = "toolStrip1";
        this.toolStrip1.Size = new System.Drawing.Size(276, 25);
        this.toolStrip1.TabIndex = 7;
        this.toolStrip1.Text = "toolStrip1";
        // 
        // 新建NToolStripButton
        // 
        this.新建NToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
        this.新建NToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("新建NToolStripButton.Image")));
        this.新建NToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.新建NToolStripButton.Name = "新建NToolStripButton";
        this.新建NToolStripButton.Size = new System.Drawing.Size(23, 22);
        this.新建NToolStripButton.Text = "新建(&N)";
        // 
        // 打开OToolStripButton
        // 
        this.打开OToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
        this.打开OToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("打开OToolStripButton.Image")));
        this.打开OToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.打开OToolStripButton.Name = "打开OToolStripButton";
        this.打开OToolStripButton.Size = new System.Drawing.Size(23, 22);
        this.打开OToolStripButton.Text = "打开(&O)";
        // 
        // 保存SToolStripButton
        // 
        this.保存SToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
        this.保存SToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("保存SToolStripButton.Image")));
        this.保存SToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.保存SToolStripButton.Name = "保存SToolStripButton";
        this.保存SToolStripButton.Size = new System.Drawing.Size(23, 22);
        this.保存SToolStripButton.Text = "保存(&S)";
        // 
        // 打印PToolStripButton
        // 
        this.打印PToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
        this.打印PToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("打印PToolStripButton.Image")));
        this.打印PToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.打印PToolStripButton.Name = "打印PToolStripButton";
        this.打印PToolStripButton.Size = new System.Drawing.Size(23, 22);
        this.打印PToolStripButton.Text = "打印(&P)";
        // 
        // toolStripSeparator
        // 
        this.toolStripSeparator.Name = "toolStripSeparator";
        this.toolStripSeparator.Size = new System.Drawing.Size(6, 25);
        // 
        // 剪切UToolStripButton
        // 
        this.剪切UToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
        this.剪切UToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("剪切UToolStripButton.Image")));
        this.剪切UToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.剪切UToolStripButton.Name = "剪切UToolStripButton";
        this.剪切UToolStripButton.Size = new System.Drawing.Size(23, 22);
        this.剪切UToolStripButton.Text = "剪切(&U)";
        // 
        // 复制CToolStripButton
        // 
        this.复制CToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
        this.复制CToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("复制CToolStripButton.Image")));
        this.复制CToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.复制CToolStripButton.Name = "复制CToolStripButton";
        this.复制CToolStripButton.Size = new System.Drawing.Size(23, 22);
        this.复制CToolStripButton.Text = "复制(&C)";
        // 
        // 粘贴PToolStripButton
        // 
        this.粘贴PToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
        this.粘贴PToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("粘贴PToolStripButton.Image")));
        this.粘贴PToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.粘贴PToolStripButton.Name = "粘贴PToolStripButton";
        this.粘贴PToolStripButton.Size = new System.Drawing.Size(23, 22);
        this.粘贴PToolStripButton.Text = "粘贴(&P)";
        // 
        // toolStripSeparator1
        // 
        this.toolStripSeparator1.Name = "toolStripSeparator1";
        this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
        // 
        // 帮助LToolStripButton
        // 
        this.帮助LToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
        this.帮助LToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("帮助LToolStripButton.Image")));
        this.帮助LToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.帮助LToolStripButton.Name = "帮助LToolStripButton";
        this.帮助LToolStripButton.Size = new System.Drawing.Size(23, 22);
        this.帮助LToolStripButton.Text = "帮助(&L)";
        // 
        // menuStrip1
        // 
        this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
        this.文件FToolStripMenuItem,
        this.编辑EToolStripMenuItem,
        this.工具TToolStripMenuItem,
        this.帮助HToolStripMenuItem});
        this.menuStrip1.Location = new System.Drawing.Point(0, 0);
        this.menuStrip1.Name = "menuStrip1";
        this.menuStrip1.Size = new System.Drawing.Size(276, 24);
        this.menuStrip1.TabIndex = 8;
        this.menuStrip1.Text = "menuStrip1";
        // 
        // 文件FToolStripMenuItem
        // 
        this.文件FToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
        this.新建NToolStripMenuItem,
        this.打开OToolStripMenuItem,
        this.toolStripSeparator2,
        this.保存SToolStripMenuItem,
        this.另存为AToolStripMenuItem,
        this.toolStripSeparator3,
        this.打印PToolStripMenuItem,
        this.打印预览VToolStripMenuItem,
        this.toolStripSeparator4,
        this.退出XToolStripMenuItem});
        this.文件FToolStripMenuItem.Name = "文件FToolStripMenuItem";
        this.文件FToolStripMenuItem.Size = new System.Drawing.Size(59, 20);
        this.文件FToolStripMenuItem.Text = "文件(&F)";
        // 
        // 新建NToolStripMenuItem
        // 
        this.新建NToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("新建NToolStripMenuItem.Image")));
        this.新建NToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.新建NToolStripMenuItem.Name = "新建NToolStripMenuItem";
        this.新建NToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
        this.新建NToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
        this.新建NToolStripMenuItem.Text = "新建(&N)";
        // 
        // 打开OToolStripMenuItem
        // 
        this.打开OToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("打开OToolStripMenuItem.Image")));
        this.打开OToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.打开OToolStripMenuItem.Name = "打开OToolStripMenuItem";
        this.打开OToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
        this.打开OToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
        this.打开OToolStripMenuItem.Text = "打开(&O)";
        // 
        // toolStripSeparator2
        // 
        this.toolStripSeparator2.Name = "toolStripSeparator2";
        this.toolStripSeparator2.Size = new System.Drawing.Size(150, 6);
        // 
        // 保存SToolStripMenuItem
        // 
        this.保存SToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("保存SToolStripMenuItem.Image")));
        this.保存SToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.保存SToolStripMenuItem.Name = "保存SToolStripMenuItem";
        this.保存SToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
        this.保存SToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
        this.保存SToolStripMenuItem.Text = "保存(&S)";
        // 
        // 另存为AToolStripMenuItem
        // 
        this.另存为AToolStripMenuItem.Name = "另存为AToolStripMenuItem";
        this.另存为AToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
        this.另存为AToolStripMenuItem.Text = "另存为(&A)";
        // 
        // toolStripSeparator3
        // 
        this.toolStripSeparator3.Name = "toolStripSeparator3";
        this.toolStripSeparator3.Size = new System.Drawing.Size(150, 6);
        // 
        // 打印PToolStripMenuItem
        // 
        this.打印PToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("打印PToolStripMenuItem.Image")));
        this.打印PToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.打印PToolStripMenuItem.Name = "打印PToolStripMenuItem";
        this.打印PToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P)));
        this.打印PToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
        this.打印PToolStripMenuItem.Text = "打印(&P)";
        // 
        // 打印预览VToolStripMenuItem
        // 
        this.打印预览VToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("打印预览VToolStripMenuItem.Image")));
        this.打印预览VToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.打印预览VToolStripMenuItem.Name = "打印预览VToolStripMenuItem";
        this.打印预览VToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
        this.打印预览VToolStripMenuItem.Text = "打印预览(&V)";
        // 
        // toolStripSeparator4
        // 
        this.toolStripSeparator4.Name = "toolStripSeparator4";
        this.toolStripSeparator4.Size = new System.Drawing.Size(150, 6);
        // 
        // 退出XToolStripMenuItem
        // 
        this.退出XToolStripMenuItem.Name = "退出XToolStripMenuItem";
        this.退出XToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
        this.退出XToolStripMenuItem.Text = "退出(&X)";
        // 
        // 编辑EToolStripMenuItem
        // 
        this.编辑EToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
        this.撤消UToolStripMenuItem,
        this.重复RToolStripMenuItem,
        this.toolStripSeparator5,
        this.剪切TToolStripMenuItem,
        this.复制CToolStripMenuItem,
        this.粘贴PToolStripMenuItem,
        this.toolStripSeparator6,
        this.全选AToolStripMenuItem});
        this.编辑EToolStripMenuItem.Name = "编辑EToolStripMenuItem";
        this.编辑EToolStripMenuItem.Size = new System.Drawing.Size(59, 20);
        this.编辑EToolStripMenuItem.Text = "编辑(&E)";
        // 
        // 撤消UToolStripMenuItem
        // 
        this.撤消UToolStripMenuItem.Name = "撤消UToolStripMenuItem";
        this.撤消UToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));
        this.撤消UToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
        this.撤消UToolStripMenuItem.Text = "撤消(&U)";
        // 
        // 重复RToolStripMenuItem
        // 
        this.重复RToolStripMenuItem.Name = "重复RToolStripMenuItem";
        this.重复RToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y)));
        this.重复RToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
        this.重复RToolStripMenuItem.Text = "重复(&R)";
        // 
        // toolStripSeparator5
        // 
        this.toolStripSeparator5.Name = "toolStripSeparator5";
        this.toolStripSeparator5.Size = new System.Drawing.Size(150, 6);
        // 
        // 剪切TToolStripMenuItem
        // 
        this.剪切TToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("剪切TToolStripMenuItem.Image")));
        this.剪切TToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.剪切TToolStripMenuItem.Name = "剪切TToolStripMenuItem";
        this.剪切TToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X)));
        this.剪切TToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
        this.剪切TToolStripMenuItem.Text = "剪切(&T)";
        // 
        // 复制CToolStripMenuItem
        // 
        this.复制CToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("复制CToolStripMenuItem.Image")));
        this.复制CToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.复制CToolStripMenuItem.Name = "复制CToolStripMenuItem";
        this.复制CToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
        this.复制CToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
        this.复制CToolStripMenuItem.Text = "复制(&C)";
        // 
        // 粘贴PToolStripMenuItem
        // 
        this.粘贴PToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("粘贴PToolStripMenuItem.Image")));
        this.粘贴PToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;
        this.粘贴PToolStripMenuItem.Name = "粘贴PToolStripMenuItem";
        this.粘贴PToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V)));
        this.粘贴PToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
        this.粘贴PToolStripMenuItem.Text = "粘贴(&P)";
        // 
        // toolStripSeparator6
        // 
        this.toolStripSeparator6.Name = "toolStripSeparator6";
        this.toolStripSeparator6.Size = new System.Drawing.Size(150, 6);
        // 
        // 全选AToolStripMenuItem
        // 
        this.全选AToolStripMenuItem.Name = "全选AToolStripMenuItem";
        this.全选AToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
        this.全选AToolStripMenuItem.Text = "全选(&A)";
        // 
        // 工具TToolStripMenuItem
        // 
        this.工具TToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
        this.自定义CToolStripMenuItem,
        this.选项OToolStripMenuItem});
        this.工具TToolStripMenuItem.Name = "工具TToolStripMenuItem";
        this.工具TToolStripMenuItem.Size = new System.Drawing.Size(59, 20);
        this.工具TToolStripMenuItem.Text = "工具(&T)";
        // 
        // 自定义CToolStripMenuItem
        // 
        this.自定义CToolStripMenuItem.Name = "自定义CToolStripMenuItem";
        this.自定义CToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
        this.自定义CToolStripMenuItem.Text = "自定义(&C)";
        // 
        // 选项OToolStripMenuItem
        // 
        this.选项OToolStripMenuItem.Name = "选项OToolStripMenuItem";
        this.选项OToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
        this.选项OToolStripMenuItem.Text = "选项(&O)";
        // 
        // 帮助HToolStripMenuItem
        // 
        this.帮助HToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
        this.内容CToolStripMenuItem,
        this.索引IToolStripMenuItem,
        this.搜索SToolStripMenuItem,
        this.toolStripSeparator7,
        this.关于AToolStripMenuItem});
        this.帮助HToolStripMenuItem.Name = "帮助HToolStripMenuItem";
        this.帮助HToolStripMenuItem.Size = new System.Drawing.Size(59, 20);
        this.帮助HToolStripMenuItem.Text = "帮助(&H)";
        // 
        // 内容CToolStripMenuItem
        // 
        this.内容CToolStripMenuItem.Name = "内容CToolStripMenuItem";
        this.内容CToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
        this.内容CToolStripMenuItem.Text = "内容(&C)";
        // 
        // 索引IToolStripMenuItem
        // 
        this.索引IToolStripMenuItem.Name = "索引IToolStripMenuItem";
        this.索引IToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
        this.索引IToolStripMenuItem.Text = "索引(&I)";
        // 
        // 搜索SToolStripMenuItem
        // 
        this.搜索SToolStripMenuItem.Name = "搜索SToolStripMenuItem";
        this.搜索SToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
        this.搜索SToolStripMenuItem.Text = "搜索(&S)";
        // 
        // toolStripSeparator7
        // 
        this.toolStripSeparator7.Name = "toolStripSeparator7";
        this.toolStripSeparator7.Size = new System.Drawing.Size(127, 6);
        // 
        // 关于AToolStripMenuItem
        // 
        this.关于AToolStripMenuItem.Name = "关于AToolStripMenuItem";
        this.关于AToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
        this.关于AToolStripMenuItem.Text = "关于(&A)...";
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(276, 197);
        this.Controls.Add(this.toolStrip1);
        this.Controls.Add(this.menuStrip1);
        this.Controls.Add(this.label3);
        this.Controls.Add(this.textBox3);
        this.Controls.Add(this.label2);
        this.Controls.Add(this.textBox2);
        this.Controls.Add(this.label1);
        this.Controls.Add(this.textBox1);
        this.Controls.Add(this.button1);
        this.MainMenuStrip = this.menuStrip1;
        this.Name = "Form1";
        this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
        this.Text = "从FTP下载文件";
        this.toolStrip1.ResumeLayout(false);
        this.toolStrip1.PerformLayout();
        this.menuStrip1.ResumeLayout(false);
        this.menuStrip1.PerformLayout();
        this.ResumeLayout(false);
        this.PerformLayout();

    }

    #endregion

    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.TextBox textBox1;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.TextBox textBox2;
    private System.Windows.Forms.Label label3;
    private System.Windows.Forms.TextBox textBox3;
    private System.Windows.Forms.ToolStrip toolStrip1;
    private System.Windows.Forms.ToolStripButton 新建NToolStripButton;
    private System.Windows.Forms.ToolStripButton 打开OToolStripButton;
    private System.Windows.Forms.ToolStripButton 保存SToolStripButton;
    private System.Windows.Forms.ToolStripButton 打印PToolStripButton;
    private System.Windows.Forms.ToolStripSeparator toolStripSeparator;
    private System.Windows.Forms.ToolStripButton 剪切UToolStripButton;
    private System.Windows.Forms.ToolStripButton 复制CToolStripButton;
    private System.Windows.Forms.ToolStripButton 粘贴PToolStripButton;
    private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
    private System.Windows.Forms.ToolStripButton 帮助LToolStripButton;
    private System.Windows.Forms.MenuStrip menuStrip1;
    private System.Windows.Forms.ToolStripMenuItem 文件FToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 新建NToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 打开OToolStripMenuItem;
    private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
    private System.Windows.Forms.ToolStripMenuItem 保存SToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 另存为AToolStripMenuItem;
    private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
    private System.Windows.Forms.ToolStripMenuItem 打印PToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 打印预览VToolStripMenuItem;
    private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
    private System.Windows.Forms.ToolStripMenuItem 退出XToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 编辑EToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 撤消UToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 重复RToolStripMenuItem;
    private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
    private System.Windows.Forms.ToolStripMenuItem 剪切TToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 复制CToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 粘贴PToolStripMenuItem;
    private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
    private System.Windows.Forms.ToolStripMenuItem 全选AToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 工具TToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 自定义CToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 选项OToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 帮助HToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 内容CToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 索引IToolStripMenuItem;
    private System.Windows.Forms.ToolStripMenuItem 搜索SToolStripMenuItem;
    private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
    private System.Windows.Forms.ToolStripMenuItem 关于AToolStripMenuItem;
}

以上就是基于C#实现FTP下载文件的详细内容,更多关于C# FTP下载文件的资料请关注编程网其它相关文章!

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

基于C#实现FTP下载文件

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

基于C#实现FTP下载文件

这篇文章主要为大家详细介绍了如何利用C#实现FTP下载文件,文中的示例代码讲解详细,对我们学习C#有一定的帮助,感兴趣的小伙伴可以跟随小编一起了解一下
2022-12-26

基于C语言实现http下载器

做OTA升级功能时,我们能直接拿到的往往只是升级包的链接,需要我们自己去下载,这时候就需要用到http下载器。本文将利用C语言实现简单的http下载器,感兴趣的可以了解一下
2022-12-28

Java FTP协议实现文件下载功能

FTP(File Transfer Protocol)就是文件传输协议。通过FTP客户端从远程FTP服务器上拷贝文件到本地计算机称为下载,将本地计算机上的文件复制到远程FTP服务器上称为上传,上传和下载是FTP最常用的两个功能
2022-11-13

java实现ftp文件上传下载功能

本文实例为大家分享了ftp实现文件上传下载的具体代码,供大家参考,具体内容如下package getUrlPic;import java.io.ByteArrayInputStream;import java.io.IOException;
2023-05-31

基于nodejs+express4.X实现文件下载的实例代码

之前写了一个关于基于nodejs+express4.X实现文件下载实例,最近需要回顾,就顺便发到随笔上了 在nodejs的express框架中,下载变得非常简单,就一个方法,res.download()首先express命令行生成项目基本框
2022-06-04

基于gitee如何实现上传下载文件的功能

本文小编为大家详细介绍“基于gitee如何实现上传下载文件的功能”,内容详细,步骤清晰,细节处理妥当,希望这篇“基于gitee如何实现上传下载文件的功能”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。方案的选择文件
2023-07-05

shell脚本实现ftp上传下载文件功能

前段时间工作中需要将经过我司平台某些信息核验数据提取后上传到客户的FTP服务器上,以便于他们进行相关的信息比对核验。由于包含这些信息的主机只有4台,采取的策略是将生成的4个文件汇集到一个主机上,然后iHBkwirJm在这台主机上将文件上传的
2022-06-04

使用ftpClient如何实现下载ftp文件解析

使用ftpClient如何实现下载ftp文件解析?针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。总体思路有以下:  1、得到所有路径以及子路径:递归遍历所有文件到路径。参数:
2023-05-31

C#怎么实现FTP上传文件

本文小编为大家详细介绍“C#怎么实现FTP上传文件”,内容详细,步骤清晰,细节处理妥当,希望这篇“C#怎么实现FTP上传文件”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。1.通过用FTP进行上传文件,首先要实现建
2023-06-30

C#中怎么实现一个文件下载

这篇文章给大家介绍C#中怎么实现一个文件下载,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。首先,打开Visual Studio.Net,新建一个Visual C# Windows应用程序的工程,不妨命名为\"MyGet
2023-06-17

ASP.NETMVC实现文件下载

这篇文章介绍了ASP.NETMVC实现文件下载的方法,文中通过示例代码介绍的非常详细。对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
2022-11-13

使用Android的OkHttp包实现基于HTTP协议的文件上传下载

OkHttp的HTTP连接基础 虽然在使用 OkHttp 发送 HTTP 请求时只需要提供 URL 即可,OkHttp 在实现中需要综合考虑 3 种不同的要素来确定与 HTTP 服务器之间实际建立的 HTTP 连接。这样做的目的是为了达到最
2022-06-06

编程热搜

  • Python 学习之路 - Python
    一、安装Python34Windows在Python官网(https://www.python.org/downloads/)下载安装包并安装。Python的默认安装路径是:C:\Python34配置环境变量:【右键计算机】--》【属性】-
    Python 学习之路 - Python
  • chatgpt的中文全称是什么
    chatgpt的中文全称是生成型预训练变换模型。ChatGPT是什么ChatGPT是美国人工智能研究实验室OpenAI开发的一种全新聊天机器人模型,它能够通过学习和理解人类的语言来进行对话,还能根据聊天的上下文进行互动,并协助人类完成一系列
    chatgpt的中文全称是什么
  • C/C++中extern函数使用详解
  • C/C++可变参数的使用
    可变参数的使用方法远远不止以下几种,不过在C,C++中使用可变参数时要小心,在使用printf()等函数时传入的参数个数一定不能比前面的格式化字符串中的’%’符号个数少,否则会产生访问越界,运气不好的话还会导致程序崩溃
    C/C++可变参数的使用
  • css样式文件该放在哪里
  • php中数组下标必须是连续的吗
  • Python 3 教程
    Python 3 教程 Python 的 3.0 版本,常被称为 Python 3000,或简称 Py3k。相对于 Python 的早期版本,这是一个较大的升级。为了不带入过多的累赘,Python 3.0 在设计的时候没有考虑向下兼容。 Python
    Python 3 教程
  • Python pip包管理
    一、前言    在Python中, 安装第三方模块是通过 setuptools 这个工具完成的。 Python有两个封装了 setuptools的包管理工具: easy_install  和  pip , 目前官方推荐使用 pip。    
    Python pip包管理
  • ubuntu如何重新编译内核
  • 改善Java代码之慎用java动态编译

目录