Answer the question
In order to leave comments, you need to log in
How to pass upload file name from js variable to php?
How can I asynchronously pass the name of the uploaded file from a js variable to a php variable and echo it out?
Download form:
<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>
if($_POST['userfile']) {
$str = $_POST['userfile'];
}
echo $str;
var filename = document.getElementById("userfile").files[0].name;
alert(filename);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question