Author: zuperboy90 | Posted on: 8/11/2009 2:10:01 PM | Views : 362

Hello
I am uploading pictures using Bitmap and Graphics classes.
After i successfully save the picture, i dispose both Bitmap and Graphics functions
upBmp.Dispose(); newBmp.Dispose(); newGraphic.Dispose();
On button1 click event, i copy the pictures from temporary folder into user folder using this code
if (ViewState["urlPic1"].ToString() != "") File.Copy(MapPath(ViewState["urlPic1"].ToString()), MapPath(ViewState["urlPic1"].ToString().Replace("\t", "")), true);
This gives me the folowing error on the File.Copy line:
The process cannot access the file 'C:\inetpub\wwwroot\upload\testuser\t\119_Carnivore_plant.jpg' because it is being used by another process.
If i use File.Delete(MapPath(ViewState["urlPic1"].ToString()) it works with no error...
What can i do to resolv ...

Go to the complete details ...