$uploadpath='../upload/';
$uploadtype='image/x-pngimage/gifimage/pjpeg';
$uploadsava='';
$uploadpath.=md5(date('y:m:d h:i:s'));
$phototype=isset($_POST['select'])?$_POST['select']:"";
$title=Strreplace(isset($_POST['title'])?$_POST['title']:"null");
$say=Strreplace(isset($_POST['textarea'])?$_POST['textarea']:"null");
$tdate=date("Y:m:d");
$uploadtype=$_FILES['file']['type'];
if ($phototype=='null' || $phototype==""){
echo("");
exit();
}
if($title=="null" || $title=="" || strlen($title)>50){
$title="暂无标题";
}
if($say=="null" || $say=="" || strlen($say)>500){
$say="暂无说明";
}
if(strpos('exit:image/x-png',$uploadtype)){
$uploadsava=$uploadpath.".png";
}
if(strpos('exit:image/gif',$uploadtype)){
$uploadsava=$uploadpath.".gif";
}
if(strpos('exit:image/pjpeg',$uploadtype)){
$uploadsava=$uploadpath.".jpg";
}
if($uploadsava==''){
echo("");
exit();
}
if($_FILES['file']['size']>202400){
echo("");
exit();
}
if(move_uploaded_file($_FILES['file']['tmp_name'],$uploadsava)){
echo("");
$sql="insert into photo(name,picpath,picdate,pichit,picsay,filesendid,phototype) values('$title','$uploadsava','$tdate',1,'$say','$xm','$phototype')";
mysql_query($sql) or die('Insert Data Fail Errors'.mysql_error());
}else{
echo("");
} www.111com.net
?>
|