title: Posting ByteArray from Knockout.js to a Web Service
body: <p>I'm very new to KnockoutJS, and I dig it so far, but try as I might I couldn't find this info anywhere so I am hoping the community can help! In my View I have the following data-binding on a file input:</p>
  
  <pre><code> &lt;input type="file" data-bind="value: ImageToUpload"/&gt;
   &lt;button data-bind="click: $root.saveImage"&gt;Upload&lt;/button&gt;
  </code></pre>
  
  <p>This is part of a list in a "foreach" div, so the variable "ImageToUpload" corresponds to a property on an object from that list.</p>
  
  <p>In my ViewModel the Upload button calls saveImage() and I call the web service and pass the form data to a .aspx page:</p>
  
  <pre><code>self.saveImage = function (MyObject, event) {
  
      $.post("Service.aspx", MyObject,  function (returnedData) {
  
      });
  }
  </code></pre>
  
  <p>The object passes to my service just fine and I can access all the form data as expected including the "ImageToUpload" variable... but here is where I am stuck:</p>
  
  <p>1) The "ImageToUpload" is only a string representing the name of the file I uploaded and is not a ByteArray. How do I access the image file and not just the name?</p>
  
  <p>2) Is there a better way to pass the ByteArray as a Stream or other format in the response header?</p>
  
  <p>3) Is my technique totally off? Is there a better way to do this? My goal is to have a dynamic list of image "slots" that be uploaded to. </p>
  
  <p>Thanks in advance!</p>