Click here to Skip to main content
12,067,278 members (53,528 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET Windows Application , +
Hi All,

I want to save selected file in other folder in windows application.

Here what i want to do.
I have taken one OpenFileDialog. When i select any file using that dialog, the whole file path shows in textbox as per below code

DialogResult result= openFileDialog1.ShowDialog();
            textBox1.Text = openFileDialog1.FileName.ToString();

Now i have one other button with 'Upload' title. Now i want when i click on 'Upload' button my selected file should be save another folder where i wish(e.g. C:\UploadedImage\);

Please anyone can help me in this issue. I really need it.

Thanks and Regards

Suman Zalodiya
Posted 18-Sep-11 8:41am
Edited 18-Sep-11 9:05am
digimanus46.3K
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Try this file copy method will copy your image to new location with a new name
string fulllocimage = openFileDialog1.FileName;
File.Copy(fulllocimage, @"C:\UploadedImage\" + NewImageName);
  Permalink  
Comments
digimanus 18-Sep-11 14:06pm
   
and the @C"\UploadedImage\" part could be placed as key in the config file
suman161288 18-Sep-11 14:07pm
   
Thanks for your reply.

It's not working. Please can you give me one example?
arunkumaraymuo 18-Sep-11 14:21pm
   
May be your C drive permission problem try to save it into another drive
suman161288 18-Sep-11 14:25pm
   
Thanks Arun it's working.

Many many thanks
arunkumaraymuo 18-Sep-11 14:28pm
   
Copy(string sourceFileName, string destFileName);
naylynn 5-Jun-13 10:32am
   
Hello! All my friend--------
I'm beginner study of C#. Now i want to retrieve pdf file from my sql using by C#. Someone can me! Please.. :) Thank You--- my friends.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Finally i stop with

string fullpath=openDialog1.FileName;
string extension=Path.GetExtension(fullpath);
File.Copy(fullpath,@"D:\UploadedImages\" + "hello" + extension);

Thanks to all of you for reply.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160208.1 | Last Updated 4 Jun 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100