if($_FILES['photo']['error']>0){
echo "上传文件失败";
die;
}
$dir='./photo/';
$type=substr($_FILES['photo']['name'],strrpos($_FILES['photo']['name'],'.'));
$filename=time().rand(1000,9999).$type;
if(is_uploaded_file($_FILES['photo']['tmp_name'])){
move_uploaded_file($_FILES['photo']['tmp_name'],$dir.$filename);
echo "上传成功";
}else{
echo "上传文件失败";
}