title: Binary Upload WCF corrupt .mov File
body: <p>I am trying to Upload video File .mov to remote web service from my Fiddle Debugger to test the service but the File stored on the disk comes out to be corrupt? Any suggestions?</p>
  
  <p>Request Headers</p>
  
  <pre><code>Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
  User-Agent: Fiddler
  Host: localhost:2487
  Content-Length: 2113228
  </code></pre>
  
  <p>Request body</p>
  
  <pre><code>---------------------------acebdf13572468
  Content-Disposition: form-data; name="IMG_0888.MOV"; filename="IMG_0888.MOV"
  Content-Type: video/quicktime
  
  &lt;@INCLUDE *C:\Users\Amrit\Desktop\IMG_0888.MOV*@&gt;
  ---------------------------acebdf13572468--
  </code></pre>
  
  <p>C# Code</p>
  
  <pre><code>     FileStream fs = null;
              string UniqueId = this.GenerateUID();
              _fileDirectory = System.IO.Path.Combine(Constants._VideosDirectory,author_id);
              if (!Directory.Exists(_fileDirectory))
              {
                  Directory.CreateDirectory(_fileDirectory);
              }
              string file = Path.Combine(_fileDirectory, "test.mov");
    //        string filePath = Path.Combine(uploadFolder, request.FileName);
  
              try
              {
                  using (FileStream targetStream = new FileStream(file, FileMode.Create,
                                   FileAccess.Write, FileShare.None))
                  {
                      //read from the input stream in 65000 byte chunks
  
                      const int bufferLen = 65000;
                      byte[] buffer = new byte[bufferLen];
                      int count = 0;
                      while ((count = request.Read(buffer, 0, bufferLen)) &gt; 0)
                      {
                          // save to output stream
                          targetStream.Write(buffer, 0, count);
                      }
                      targetStream.Close();
                      return "done";
                      //sourceStream.Close();
                  }
              }
  
  
              catch (Exception)
              {
                  return "fail";
              }
              finally
              {
  
              }
  </code></pre>