Click here to Skip to main content
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 8:41am
Edited 18-Sep-11 9:05am
digimanus30.8K
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 OriginalGriff 390
1 Jochen Arndt 165
2 Richard MacCutchan 135
3 DamithSL 95
4 Garth J Lancaster 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 4 Jun 2013
Copyright © CodeProject, 1999-2014
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