title: Add-on SDK: WebDAV upload from addon
body: <p>I am trying to upload a file to a WebDAC server. iLocalFile is a reference to a local input file:</p>
  
  <pre><code>  var inputStream = Cc["@mozilla.org/network/file-input-stream;1"]
                      .createInstance(Ci.nsIFileInputStream);
    inputStream.init(iLocalFile, DELETE_ON_CLOSE, 0, 0);
  
    var oIOService = Cc["@mozilla.org/network/io-service;1"]
                     .getService(Ci.nsIIOService)
    var oHttpChannel = oIOService.newChannel(sRemoteFileName, "", null);
    oHttpChannel.QueryInterface(Ci.nsIHttpChannel);
    oHttpChannel.requestMethod = 'PUT';
    oHttpChannel.QueryInterface(Ci.nsIUploadChannel);
    oHttpChannel.setUploadStream(inputStream, 'application/pdf', -1);
  
    var result = '';
    console.log('Upload starting')
    oHttpChannel.asyncOpen(in nsIStreamListener, result);
  </code></pre>
  
  <p>My problem is that I don't know how to implement the nsIStreamListener. I would be quite happy to thow away the response content if failure/success is still available.</p>
  
  <hr>
  
  <h2>Edit 1: Solution</h2>
  
  <p>As per the selected answer with the following modification:</p>
  
  <pre><code>  var inputStream = Cc["@mozilla.org/network/file-input-stream;1"]
                      .createInstance(Ci.nsIFileInputStream);
    inputStream.init(iLocalFile, -1, 0, 0);
    xhr.send(inputStream);
  </code></pre>