Click here to Skip to main content
Rate this: bad
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
Rate this: bad
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);
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
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.

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

  Print Answers RSS
0 Maciej Los 495
1 OriginalGriff 400
2 Sergey Alexandrovich Kryukov 394
3 CHill60 320
4 Sascha Lefévre 269
0 Sergey Alexandrovich Kryukov 10,017
1 OriginalGriff 9,495
2 Peter Leow 5,241
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,076

Advertise | Privacy | Mobile
Web04 | 2.8.150327.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