title: Assigning a file input's file with jQuery
body: <p>I have an empty file input field on a page that I would like to populate with a file that already exists on the page using jQuery.</p>
  
  <p>For example, I have the following link:</p>
  
  <pre><code>&lt;a href="download.pdf" class="file"&gt;Download Me&lt;/a&gt;
  </code></pre>
  
  <p>And the following form:</p>
  
  <pre><code>&lt;form&gt;
       &lt;input type="file" value=""&gt;
       &lt;input type="submit" value=""&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I would like to use jQuery to take the href of the link, and then assign it to the file upload. I could easily start this by assigning a variable to the href like so:</p>
  
  <pre><code>var download = $("a.file").attr("href");
  </code></pre>
  
  <p>But then how would I go about assigning the file input's upload with this variable?</p>