<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<script type="text/javascript">
</script>
<style type="text/css">
</style>
</head>
<body>
<form method="post" action="up.php" enctype="multipart/form-data">
<input type="file" name="file"/>
<input type="submit" value="上传"/>
</form>
<table>
<tr> <td>id</td> <td>图片</td><td>时间</td><td>操作</td></tr>
<?php
$dir=opendir("../uploads/");
$i=0;
while($f=readdir($dir)){
if($f!=='.'&&$f!=='..'){
if(strpos($f,'.jpg',1)){ / /把后缀是jpg的取出来
/*
也可以建立一个数组 $imgtype=array('image/jpeg','image/jpg');
if(in_arrary($_FILES['formname']['type'],$imgtype)){
}
*/
$i++;echo "<tr>";
echo "<td>($i)</td>";
echo "<td><img src='../uploads/$f' width='80' height='50'></td>";
echo "<td>预览,下载</td>";
echo "</tr>";
}
}
}
?>
</table>
</body>
</html>