At present, my source code project is in disk E, this is its path : E:\WindowsApplication1
In this folder has a folder Files, with path : E:\WindowsApplication1\WindowsApplication1\bin\Debug\Files

I have a form with a browse button to choose file, after choose file, it will save into folder Files automatically. My chosen file is in disk C : C:\Images\image.jpg
This is my problem : after choose file, an errors occurs :
Could not find a part of the path 'C:\Images\WindowsApplication1\bin\Debug\Files\image.jpg'.?
How can I set to default path when I chose the file?
Please help me?

use this

OpenFileDialog file_open = new OpenFileDialog();           
            if (file_open.ShowDialog() == DialogResult.OK)
            {
                string source_file = file_open.FileName;
                string path_nm = E:\WindowsApplication1\WindowsApplication1    \bin\Debug\Files;
                string Dest_file = path_nm + file_open.SafeFileName;
                System.IO.File.Copy(source_file, Dest_file, true);
                txtpath.Text = Dest_file;
               
            }

hope it will helps...

At present, my source code project is in disk E, this is its path : E:\WindowsApplication1
In this folder has a folder Files, with path : E:\WindowsApplication1\WindowsApplication1\bin\Debug\Files

I have a form with a browse button to choose file, after choose file, it will save into folder Files automatically. My chosen file is in disk C : C:\Images\image.jpg
This is my problem : after choose file, an errors occurs :
Could not find a part of the path 'C:\Images\WindowsApplication1\bin\Debug\Files\image.jpg'.?
How can I set to default path when I chose the file?
Please help me?

Show your Source where the error occurs that way we have a visual to narrow down the error

thanks to bhagawatshinde andCsharpChico. I did it. Thanks again

Cheers !!!!!!!! mark these thread as solved.

using physical path you can get images in asp.net

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.