Codice PHP:
<?php
$action = $_REQUEST['action'];
if ($action) {
if ($action=='upload') {
// upload file
}
if ($action=='download') {
// download file
}
if ($upload=='cancella') {
// cancella file
}
}
?>
<html>
<head>
<title>File Download</title>
</head>
<body>
[url="<?=$PHP_SELF?>?action=upload"]Upload File[/url] [url="<?=$websiteurl?>"]Return to <?=$websitename?>[/url]";
<form id="options" method="post" action="<?=PHP_SELF?>">
<?php
$list = "<table width=700 border=1 bordercolor=#000000 style=\"border-collapse: collapse\">";
$list .= "<tr><td width=700><center>[b]Click To Download[/b]</center></td></tr>";
$dir = opendir($absolute_path);
while($file = readdir($dir)) {
if (($file != "..") and ($file != ".")) {
$list .= "<tr><td width=700><center>$file</a></center></td>";
$list .= "<td><input type=\"button\" value=\"download\" onclick=\"document.forms[0].action='<?=$PHP_SELF?>?action=download; document.forms[0].submit()\" />";
$list .= "input type=\"button\" value=\"cancella\" onclick=\"document.forms[0].action='<?=$PHP_SELF?>?action=cancella; document.forms[0].submit()\" /></td></tr>";
}
}
$list .= "</table>";
echo $list;
</form>
echo"
Powered by <a href=http://www.davidefrancese.it/>PHP Uploader Downloader</a>";
?>
</body>
</html>";
come vedi assieme al nome di file ho aggiunto due pulsanti DOWNLAOD e CANCELLA; quando ci clicchi la pagina viene ricaricata ed eseguito l'ordine scelto.