C# WINFORM 上传图片 并保存在程序的根目录的某个文件夹中

        private void btnUpLoad_Click(object sender, EventArgs e)
        {
            DialogResult dr = openFileDialog1.ShowDialog();
            if (dr == DialogResult.OK)
            {
                image = openFileDialog1.FileName;
                picpath = openFileDialog1.FileName;
                t = 1;
                pictureBox1.Image = Image.FromFile(image);

                File.Copy(openFileDialog1.FileName, Application.StartupPath + "\\Image\\" + id + ".jpg");
            }
        }

你可能感兴趣的:(WinForm)