Click here to Skip to main content
16,012,468 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi friends,
Please anyone help me how to rename the image file..

1. The image file name is 1.jpg
2. I want to rename it according to the value entered in the textbox.

C#
str = images[currIndex].Name.ToString();
           string name = txt_imagename.Text;
           File.Copy(str, name, true);


I tried the above code its not working.

Error:
Could not find file '1.JPG'.

please help me
Posted
Comments
Sergey Alexandrovich Kryukov 18-Aug-12 3:07am    
"Not working" is not descriptive. What's not working? And you are doing it wrong. And who cares if it image or not? Rename is rename.
--SA
Sergey Alexandrovich Kryukov 18-Aug-12 3:08am    
By the way, what's broken? MSDN? Google? Bing?
--SA
P.Vinoth 18-Aug-12 3:11am    
i cant rename that image....
P.Vinoth 18-Aug-12 3:12am    
i have submitted the error..
AmitGajjar 18-Aug-12 3:15am    
Make sure your "1.jpg" file exist in root location.

1 solution

Please see my comments to the question. You need two things:
http://www.dotnetperls.com/file-move[^],
Microsoft Q209354.

Good luck,
—SA
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900