0

Hi all
I would just like to know how can I copy a file to a specified folder and the user chooses the file say via a openfiledialog. Now I cant specify a file because the folder is empty so I cant make use of the File.Copy method but there can be a vast amount of files copied to the folder. But not at once though. I have been busy searching the internet a while now and still I cant get something that tells me how to do it. Any help would be appreciated
Kind Regards
Weppies

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Rynkadink
0

I'm not quite sure what your asking. Why can't you use File.Copy()?
You can select a file from a dialog using OpenFileDialog object, this will give you the file selected, having paths and file name then it's just a matter of copy...
You could use a function to copy like this:

public bool CopyFileTo(string filepath, string topath)
    {
        try
        {
            File.Copy(filepath, topath);
            return true;
        }
        catch (IOException ioe)
        {
            return false;
        }
    }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.