<?
include "UploadManager.php";
if (@$delete) {
UM::deleteFile($delete);
header("Location: http://$HTTP_HOST");
exit;
}
if (@$submit) {
UM::uploadFile($_FILES["user_file"], $replace, $user_info);
header("Location: http://$HTTP_HOST");
exit;
}
?>
<html>
<head>
<title>Upload Manager Demo</title>
<style>
body, table {
font-family: Verdana;
font-size: 12;
}
a {
color: #0000FF;
font-family: monospace;
padding: 2;
text-decoration: none;
}
a:hover {
background-color: #666666;
color: #FFFFFF;
}
.handle {
background-color: #CCCCCC;
color: #333333;
font-weight: bold;
font-size: 16;
}
.uploader {
border: 1 solid #000000;
background-color: #EEEEEE;
width: 400;
}
.input {
border: 1 solid #000000;
width: 100%;
}
</style>
</head>
<body>
<p align=right><a style="border: 1 solid #000000; height: 10; padding: 15;" href="/">Home</a></p>
<form method=post enctype="multipart/form-data" action="<?=$SCRIPT_NAME?>">
<table class=uploader align=center border=0 cellpadding=2 cellspacing=2>
<tr>
<td align=right>Upload file</td>
<td width=70%><input type=file class=input name="user_file"></td></tr>
<tr>
<td align=right>
<input type=hidden name="replace" value="0">
<input type=checkbox name="replace" value="1"></td>
<td>Replace if exists</td></tr>
<tr>
<td align=right>File Information</td>
<td><textarea class=input name="user_info"></textarea></td></tr>
<tr>
<td></td>
<td><input type=submit class=input name="submit" value="Save"></td></tr>
</table>
</form>
</body>
<?
if (!isset($sort)) $sort = "N";
if (!isset($dir)) $dir = 1;
if ($info = UM::readInfo($sort, $dir)) {
?>
<table border=0 cellpadding=5 cellspacing=1 width=100%>
<tr bgcolor=#CCCCCC>
<?
$heads = array(
"File" => array("N", 25),
"Size" => array("S", 10),
"Type" => array("Y", 15),
"Time" => array("T", 15),
"Info" => array("I", 30),
);
foreach ($heads as $h_name => $h_val) {
?>
<th width=<?=$h_val[1]?>%>
<?=$h_name?>
<a class=handle href="/?sort=<?=$h_val[0]?>&dir=0" title="Descending">«</a>
<a class=handle href="/?sort=<?=$h_val[0]?>&dir=1" title="Ascending">»</a></th>
<?
}
?>
<th></th></tr>
<?
foreach ($info as $k => $v) {
?>
<tr bgcolor=#EEEEEE>
<td><a href="<?=$v["url"]?>"><?=$k?></a></td>
<td align=right><?=$v["size"]?></td>
<td><?=$v["type"]?></td>
<td><?=date("Y/m/d H:i:s", $v["mtime"])?></td>
<td><?=nl2br($v["info"])?></td>
<td width=1%><a class=handle href="/?delete=<?=$k?>" title="Delete">X</a></td></tr>
<?
}
?>
</table>
<?
}
?>
</html>
|