This is possible. I used
$(".upbtn").change(function(e) {
var datoteka = $(this).val();
var lastIndex = datoteka.lastIndexOf("\\");
if (lastIndex >= 0)
{
datoteka = datoteka.substring(lastIndex + 1);
}
var close = $(this).parent().next(".filename:first")
close.val(datoteka);
});
Here is the JSFiddle
The alignment of your inputs and such might not be as desired, but the JSFiddle shows the general idea of what I think you are trying to achieve.