<?
session_start();
if(!session_is_registered("126cmsadmindb"))
{
echo "<center>";
echo "您尚未登录！";
echo "</center>";
exit;
}

include ("../../include/function.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>上传图片</title>
<style type="text/css">
<!--
.font {
	font-size: 12px;
}
-->
</style>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" class="font">
  <tr>
    <td align="center" valign="middle">
  <?

//要上传到数据库的信息有：
// 调用图片时用的图片名称：$up_pic_file_name


     //////////////////////取得文件类型//////////////////////
      include('./file_type.php');
	 
	$fileArr   = $_FILES['user_file'];
	$file_name = $fileArr['name'];
	$pic_file_type = getfiletype($file_name);

     $id                 =   date("Ymdhis");
     
     $up_pic_file_name   =   $id.".".$pic_file_type ;
     $up_file            =   "../../upload/edit_pic/".$up_pic_file_name; 
	 //echo $up_file;
	 if (!file_exists("../../upload/edit_pic/")) {
		   notfate_any_mkdir("../../upload/edit_pic/",0777);
		}
		
//echo "<br>\$up_file: ".$up_file;
     
//echo "<br>临时文件".$_POST['user_file']['tmp_name']."<br>"; 
	 if(! copy($fileArr['tmp_name'],$up_file) )
	 {
	 echo "上传图片失败！";
	 exit;
	 }
	echo "<script>top.document.forms[0].elements['ImgUrl'].value='$up_file';top.document.PREVIEWPIC.src='$up_file'</script>";
	 
?>

	</td>
  </tr>
</table>
</body>
</html>
