日期:2014-05-16 浏览次数:20688 次
<!DOCTYPE html>
<html>
<head>
<title>Test the input</title>
</head>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
<label for="picture">PICTURE:</label><br />
<input type="file" name="picture" id="picture"/><br/>
<input type="submit" name="submit" value="submit"/>
</form>
</body>
</html>
<?php
$photo_dir='/var/www/images/';
if(!is_dir($photo_dir)||is_writeable($photo_dir)){
die('No dir exist or can write');
}
if($_FILES['picture']['error']>0){
echo 'Error:'.$_FILES['picture']['error'].'<br/>';
}
else{
echo "Upload:".$_FILES['picture']['name'].'<br />';
echo "Type:".$_FILES['picture']['type'].'<br />';
echo "Size:".($_FILES['picture']['size']/1024).'kb<br/>';
echo "Stred in:".$_FILES['picture']['tmp_name'].'<br />';
if(file_exists('/var/www/images/'.$_FILES['picture']['name']))
{
echo $_FILES['picture']['name'].'already exists';
}
else
{