Easiest way to do is what @Molo mentioned in his comment.
$('#element_id').trigger("click"); OR $('.element_class').trigger("click");
$('#element_id').trigger("mousedown"); OR $('.element_class').trigger("mousedown");
Or you could, reset the .html() of the upload element
$('#'+id).html($('#'+id).html()); OR $('.'+class).html($('.'+class).html());
JavaScript into Drupal can be done in various ways, you could reference your javaScript file in your theme's info file or you override the drupal_add_js function in template.php and add your JavaScript.
For more Information on how to put JavaScript into Drupal see this or this and these (module or module) could also be handy. This article explains how to programmatically submit a form in Drupal.
Here is a good tutorial, how to add your JavaScript to Drupal https://www.drupal.org/node/756722
.trigger( "click" )
on that button? This is an universal jQuery method, but I see no reason for it to fail for you. – Mołot Sep 8 '14 at 14:38