I am uploading multiple files and when upload is successful, I want for each file, echo Upload successful! with Filename
The problem is: when there are multiple files, the echo for each file overwrites the other one. So I can only see Upload successful! with Filename
from the last uploaded file! How can I make the echo's for each file that is being uploaded under each other in the same div (alert-success)?
This is my code:
///---///
else {
// file is ready to be uploaded
$tmpFilePath = $_FILES['file']['tmp_name'];
$newFilePath = $dir.'/' . $_FILES['file']['name'];
if(move_uploaded_file($tmpFilePath, $newFilePath)) {
echo '<br /><div class="alert alert-success"><b>Upload Successful!</b> File: '.$_FILES["file"]["name"].'</div><br />';
}
exit;
}
This is the html for uploading the files:
<!-- DROPAREA -->
<div id="drop_file_zone" ondrop="upload_file(event)" ondragover="return false">
<div id="drag_upload_file">
<p>DROP FILE(S) HERE</p>
<p>or</p>
<p><input class="browse btn btn-primary" type="button" value="Browse" onclick="file_explorer();"></p>
<input type="file" id="selectfile" name="upload" multiple>
</div>
</div>
<!-- END DROPAREA -->