I have a form which shows a file in server and gives me option to handle it like rename, delete, etc.
Here the code:
if ($handle = opendir('./uploads')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$file = substr($file, 0, -4);
echo '<form action="w03handling.php" method="POST">';
echo "<input type='hidden' name='name' value='$file'>";
echo "<input type='text' name='new_name' value='$file'>";
echo '<input type="image" name="calc" src="img/ok.png" alt="Calculate" title="Calculate">';
echo '<input type="image" name="rename" src="img/edit.png" alt="Rename" title="Rename">';
echo '<input type="image" name="subst" src="img/change.png" alt="Upload new file" title="Upload new file">';
echo '<input type="image" name="del" src="img/delete.png" alt="Delete" title="Delete">';
echo '</form>';
}
}
closedir($handle);
}
It reads all files in one folder, list them all in the screen with the respective handling possibilities.
I would like to display a message when I click on DELETE which asks the user if he really wants to delete the file.
How can I do that?