The process cannot access the file ' ' because it is being used by another process

前端 未结 3 811
小蘑菇
小蘑菇 2021-01-28 17:13

I am trying to delete local copy(on the computer) of an image file once uploaded using file dialog. It throws The process cannot access the file \'C:\\Documents and Settings\\us

3条回答
  •  [愿得一人]
    2021-01-28 17:25

    you need to dispose of the bitmap object try doing this. As this will dispose of the bitmap object as soon as it leaves the using context { }

    using (Bitmap bitmap1 = new Bitmap(FilePathCopy))
    {
      //do all bitmap stuff in here
    }
    

提交回复
热议问题