title: not able to split a file and send and then join in server
body: <p>I am uploading file from client side using ajax javascript which i split in chunks and in the server when all the chunks are recieved i join them. But the problem is that even though the original file and uploaded file are of same size but both are different. I mean gif files when i view its different and same with video files.client side code</p>
  
  <pre><code>    var xhr = new XMLHttpRequest();
  
      var tempBlob = blob;
      var blobOrFile = tempBlob.slice(fileDataStart, fileDataSent);
      xhr.open('POST', '/Portfolio/UploadBinaryFiles', false);
  
      xhr.setRequestHeader("Cache-Control", "no-cache");
      xhr.setRequestHeader("X-File-Name", fileName);
      xhr.setRequestHeader("X-File-Size", fileSize);
      xhr.setRequestHeader("X-File-BytesSent", fileDataSent);
      xhr.setRequestHeader("X-File-SplitCounter", fileSplitCounter);
      xhr.setRequestHeader("Content-Type", "multipart/form-data");
  
      xhr.send(blobOrFile);
  </code></pre>
  
  <p>server side code to join</p>
  
  <pre><code>    FileStream fsSource = new FileStream(FileOutputPath, FileMode.Append);
  
      // Loop through all the files with the *.part extension in the folder
      foreach (FileInfo fiPart in diSource.GetFiles(@"*.part"))
      {
          // Create a byte array of the content of the current file
          Byte[] bytePart = System.IO.File.ReadAllBytes(fiPart.FullName);
          // Write the bytes to the reconstructed file
          fsSource.Write(bytePart, 0, bytePart.Length);
      }
  </code></pre>
  
  <p>to save split file in server</p>
  
  <pre><code>// Read input stream from request
  byte[] buffer = new byte[Request.InputStream.Length];
  int offset = 0;
  int cnt = 0;
  while ((cnt = Request.InputStream.Read(buffer, offset, 10)) &gt; 0)
  {
      offset += cnt;
  }
  // Save file
  using (FileStream fs = new FileStream(fullNameNoExt, FileMode.Create))
  {
      fs.Write(buffer, 0, buffer.Length);
      fs.Flush();
  }
  </code></pre>