Каким образом можно асинхронно передать имя загружаемого файла из переменной js в переменную php и вывести через эхо?
Форма загрузки:
<div id="upload">
<form action="upload.php" method="post" target="hiddenframe" enctype="multipart/form-data" onsubmit="hideBtn();">
<br>
<input type="file" id="userfile" name="userfile" />
<input type="submit" name="upload" id="upload" value="Загрузить" />
</form>
PHP:
if($_POST['userfile']) {
    $str = $_POST['userfile'];
   }
   echo $str;
JS:
var filename = document.getElementById("userfile").files[0].name;
  alert(filename);