Upload File Hình ảnh trong window form

-Cho mình hỏi trong window form có control nào giúp ta upload 1 file hình ảnh vào trong 1 thư mục mình định sẵn trong window form không ?
-Mình nhấn vào 1 button. Một cái Dialog hiện ra. Và mình chọn 1 file hình ảnh để upload vào trong 1 folder mình đã tạo trước trong project window form. Bạn nào biết chỉ mình với..Cám ơn nhiều.
 
  • Chủ đề
    cho dow hình ảnh thư trong upload với
  • Ðề: Upload File Hình ảnh trong window form

    mấy bửa nay bận quá hong làm,bửa nay rảnh hihi.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;

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

    private void button1_Click(object sender, EventArgs e)
    {
    try
    {
    OpenFileDialog dlg = new OpenFileDialog();
    dlg.Filter = "file hinh|*.jpg|all file|*.*";
    dlg.InitialDirectory = @"E:\";
    dlg.Multiselect = true;
    string a = null;
    if (dlg.ShowDialog() == DialogResult.OK)
    {
    string[] tmp = dlg.FileNames;
    foreach (string i in tmp)
    {
    FileInfo fi = new FileInfo(i);
    string[] xxx = i.Split('\\');
    string des = Application.StartupPath + @"\" + xxx[xxx.Length - 1];
    File.Delete(des);

    //over.
    fi.CopyTo(des);
    }
    MessageBox.Show("thang cong ");
    }
    }
    catch (Exception ex) { MessageBox.Show(ex.Message); }

    }
    }
    }
    mediafire.com/?8olffbr7hl3uf5l - link down project lun nek
     
    ppB0D2L.jpg
     

    Thống kê

    Chủ đề
    100,715
    Bài viết
    467,522
    Thành viên
    339,841
    Thành viên mới nhất
    hczghsgemwwin
    Top