Both "input[name=files]"
and "input[name=UploadFile]"
are dynamically created. You should create delegated event handlers for both of them.
Another problem with your code is you add event handler for "input[name=files]"
each time "input[name=UploadFile]"
is clicked, this could cause problem of multiple event handler being added.
This line: $("input[name=files]").change(function() {
just adds event handler, that's why you don't see the alert
Also try $.on instead of live as live is deprecated:
$(document).on("change","input[name=files]",function(){
alert($(this).val());
});
$(document).on("click","input[name=UploadFile]",function(){
$("input[name=files]").trigger("change"); //trigger event instead of add event handler like in your code.
});