title: Clearing an HTML file upload field via JavaScript
body: <p>I want to reset a file upload field when the user selects another option.</p>
  
  <p>Is this possible via JavaScript? I'm suspecting that the file upload element is treated differently because it interacts with the user's file system, and maybe it's immutable.</p>
  
  <p>Basically, what I want is something like (pseudo-code):</p>
  
  <pre><code>// Choose selecting existing file
  $('#select-file').bind('focus', function() {
    // Clear any files currently selected in #upload-file
    $('#upload-file').val(''); 
  }) ;
  
  // Choose uploading new one - this works ok
  $('#upload-file').bind('focus', function() {
    // Clear any files currently selected in #select-file
    $('#select-file').val(''); 
  }) ;
  </code></pre>
  
  <p>NB: <strong>This question and its answers span the period from 2009 to today.</strong> Browsers and approaches have changed in that time, please select your solutions with this in mind :)</p>