$type=$_FILES['filephoto']['type'];
if($type=='image/gif'|| $type=='image/jpeg'||$type=='image/pjpeg')
{
if($_FILES['filephoto']['size']<2*1024*1024)
{
$aa=substr($_FILES['filephoto']['name'],strpos($_FILES['filephoto']['name'],'.'));//图片类型名 如 .png
$photo=date("yndhis").rand(10000,99999).$aa;//图片名字
move_uploaded_file( $_FILES['filephoto']['tmp_name'] , 'photo/'.$photo );//上传指定文件夹
}//$image=文件夹名/图片名 添加数据库