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.
For example, I have the following link:
<a href="download.pdf" class="file">Download Me</a>
And the following form:
<form>
<input type="file" value="">
<input type="submit" value="">
</form>
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:
var download = $("a.file").attr("href");
But then how would I go about assigning the file input's upload with this variable?