public static void CopyStream(System.IO.Stream input, System.IO.Stream output) { var buffer = new byte[8 * 1024]; int length; while ((length = input.Read(buffer, 0, buffer.Length)) > 0) { output.Write(buffer, 0, length); } output.Close(); }