Click here to Skip to main content
11,642,216 members (61,295 online)
Rate this: bad
good
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 7:41am
Edited 18-Sep-11 8:05am
digimanus37.6K
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 at 18-Sep-11 14:06pm
   
and the @C"\UploadedImage\" part could be placed as key in the config file
suman161288 at 18-Sep-11 14:07pm
   
Thanks for your reply.

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

Many many thanks
arunkumaraymuo at 18-Sep-11 14:28pm
   
Copy(string sourceFileName, string destFileName);
naylynn at 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
0 DamithSL 240
1 Sergey Alexandrovich Kryukov 184
2 Afzaal Ahmad Zeeshan 139
3 OriginalGriff 135
4 Mika Wendelius 80
0 Mika Wendelius 460
1 DamithSL 443
2 OriginalGriff 340
3 Afzaal Ahmad Zeeshan 228
4 Sergey Alexandrovich Kryukov 179


Advertise | Privacy | Mobile
Web03 | 2.8.150731.1 | Last Updated 4 Jun 2013
Copyright © CodeProject, 1999-2015
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