PDF文件被覆盖

时间:2018-12-11 05:41:18

标签: c# asp.net file

我正在尝试将字节数组写入单个PDF文件。我想将多个字节数组写入单个文件。我正在使用以下代码。

foreach (string byteArray in byteArrayS)
{
  byte[] bytes = Convert.FromBase64String(byteArray);
  if (!File.Exists("filepath"))
  {
     File.WriteAllBytes("filepath", bytes);
  }
  else
  {                        
    using (FileStream stream = File.Open("filepath", FileMode.Append))
      {
         stream.Write(bytes, 0, bytes.Length);
      }
  }                        
 }

但是使用上述代码时,文件将被覆盖。谁能帮我。预先感谢。

0 个答案:

没有答案
相关问题