I have he following code
    HttpPostedFileBase files = Request.Files[0];
    Stream fileStream = files.InputStream;
    using (Stream file = System.IO.File.OpenWrite(originalImage))
    {
        StreamUtil.CopyStream(fileStream, file);
        file.Close();
        fileStream.close();
        fileStream.dispose();
    }
    // here is CopyStream method
    public static void CopyStream(Stream input, Stream output)
    {
        var buffer = new byte[8*1024];
        int len;
        while ((len = input.Read(buffer, 0, buffer.Length)) > 0)
        {
            output.Write(buffer, 0, len);
        }
    }
When i try to write the same file twice i get
The process cannot access the file \u0027D:FILENAME because it is being used by another process
How can i close this ?so once the request the writing is done, it will be closed?
 
     
    