• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

How to Save the file on application folder?

Hi Dear Friends,

I am creating one Windows Application in C# using VS.NET 2005.
I have one textbox, a Browse Button & a Save button on my windows form.

When user clicks on browse button, the file name will displayd in the Textbox.
After user clicks on the Save button, then I want to save the file to my application's "Images" folder.

Please, reply if you have the soluton or any trick to do this.

Thanks in advance...

From
-spdude
0
spdude
Asked:
spdude
1 Solution
 
YZlatCommented:
string apppath;
           
            // get your personal application folder
            apppath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);

            // create application path
            apppath = Path.Combine( apppath, "Images" );

            // create path if it doesn't exist
            if (!Directory.Exists(apppath))
                Directory.CreateDirectory(apppath);

            // append configuration's filename to path string
            apppath = Path.Combine( apppath, "yourfilename.extension" );
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now