I've created a popup from which you can select a file to upload, that has the following structure:
<div id = 'upload_container'>
<span id = "close_btn">X</span>
<!--Content-->
<input type = 'file' id = 'upload_hidden' name = 'file_to_upload'>
<p id = 'upload_container_text'>Choose a file to upload</p>
<p id = 'file_name'><?php echo $file_name ?></p>
<!-- // -->
</div>
The way i trigger the window to select a file is by clicking the "Choose a file to upload" that will trigger the click event on the file input which is hidden.
The thing i want to do now is to display the file name that was chosen, on the paragraph with the id 'file_name' . What i tried is:
$file_name = "";
if(isset($_FILES['file_to_upload'])){
$file_name = $_FILES['file_to_upload']['name'];
}
and to the paragraph i added:
<p id = 'file_name'><?php echo $file_name ?></p>
but nothing happens. Any ideas ?
Thank you.