title: file upload using knockout js
body: <p>File upload not working using knockout js. I have tried with below code but not working. Please mention where I am doing wrong.</p>
  
  <p>This is my file control and button. I am unable to send the selected file from the client side to the server. Please suggest what is the best approach for this.</p>
  
  <pre><code>&lt;input id="files" name="files" type="file" class="input-file" data-bind="file: FileProperties.FileName"/&gt; 
  &lt;button data-bind="click : Upload"&gt;Upload&lt;/button&gt;
  
  &lt;script type="text/javascript"&gt;
  
      ko.bindingHandlers.file = {
          init: function (element, valueAccessor) {
              alert('init');
              $(element).change(function () {
                  var file = this.files[0];
                  if (ko.isObservable(valueAccessor())) {
                      valueAccessor()(file);
                  }
              });
          }
  &lt;/script&gt;
  </code></pre>