OpenFileDialog openFileDialog1 = new OpenFileDialog();
                openFileDialog1.Filter = "图片(*.jpg;*.jpeg)|*.jpg;*.jpeg";
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {   
                    if (openFileDialog1.FileName != "")
                    {
                        this.textBox1.Text = openFileDialog1.FileName;
                    }
用这一步得到了原文件的路径    想复制到D:/重命名为SSS.JPG    但是如果D:/已经存在SSS.JPG用FILE.COPY()来复制就会提示错误,请问还有什么方法么?

解决方案 »

  1.   

     System.IO.File.Copy("x:/重命名为SSS.JPG". "D:/重命名为SSS.JPG, true);
      

  2.   

    如果D:/里已经存在一个名为SSS.jpg的文件   该怎么办呢???
      

  3.   

    我在想是不是可以在程序最后把复制到D:/SSS.jpg的文件删掉,就不知道要怎么弄了!
      

  4.   

    System.IO.File.Copy(String, String, Boolean)  Copies an existing file to a new file. Overwriting a file of the same name is allowed.