I can get the file name from file upload to the textarea in IE and Chrome. But it not work on firefox, how can i solve this problem?
Many Thanks.
function takeName(event) {
let filename = event.path[0].files[0].name;
document.getElementById("txtComment").value = filename;
}
<form id="Apply" name="Apply" method="post" enctype="multipart/form-data" action="applyLeave.php">
Get upload filename to textarea:
<p><textarea rows="3" cols="30" name="txtComment" id="txtComment" class="valid"></textarea></p>
<p>Select image to upload: <input type="file" onchange="takeName(event)" name="fileToUpload" id="fileToUpload"></p>
<p><input type="submit" value="Submit" name="submit"></p>
</form>