title: xmlhttprequest(xhr) object difference between xhr.onerror and xhr.upload.onerror
body: <p>This might be a very obvious question but please explain what is the difference between <code>xhr</code> and <code>xhr.upload</code>?</p>
  
  <p>My use case is that I am uploading a file to a server but suppose the server goes down. In this case should I handle <code>xhr.onerror</code> or <code>xhr.upload.onerror</code></p>
  
  <p>Basically, as mentioned in the question, when to use xhr and when to use <code>xhr.upload</code> where <code>xhr = new XMLHttpRequest();</code></p>
  
  <p>Another newbie question on the same, is it related to how GET vs POST/PUT are handled?</p>