Click here to Skip to main content
16,004,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The process cannot access the file 'D:\\Images\Logo.jpg' because it is being used by another process.

i am using this fode for copy image in folder :

C#
string P_Path = dt1.Rows[0]["Path"].ToString() + "Logo" + Extention;
                                                                               System.IO.File.Delete(P_Path);
System.IO.File.Copy(PhotoPath + @"\" + filename, P_Path, true);


but is is work only one time, when i am copy second time then display this error :-

The process cannot access the file 'D:\\Images\Logo.jpg' because it is being used by another process.
Posted
Updated 20-Aug-14 23:33pm
v2
Comments
ChauhanAjay 21-Aug-14 5:36am    
Just check the below link may be it helps.

http://stackoverflow.com/questions/3109294/uploading-photo-because-it-is-being-used-by-another-process
Herman<T>.Instance 21-Aug-14 5:58am    
set is as an answer!

1 solution

 
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