【www.gdgbn.com--元旦图片】
@session_start();
require_once("../Inc/Conn.php");
require_once("../Inc/function.php");
$filepath = "../userhead/";
$filename = time().mt_rand(10,100);
//$uid = get_id($_SESSION["uname"]);
$uid = 14;
if (isset($GLOBALS["HTTP_RAW_POST_DATA"]))
{
$im = $GLOBALS["HTTP_RAW_POST_DATA"];
if( !is_dir( $filepath ) )
{
mkdir($filepath,0777);
}
if(file_put_contents($filepath.$filename.".jpg",$im))
{
$path = "http://".$_SERVER["HTTP_HOST"]."/userhead/".$filename.".jpg";
savaPath($path);
}
else
{
ShowMsg("result:false");
}
}
function savaPath($path)
{
global $uid;
$sql = "Insert into dd(oy_uid,oy_dsp,oy_path) value("$uid","","$path")";
if( mysql_query( $sql ) )
{
ShowMsg("result:true");
}
else
{
ShowMsg("result:false".mysql_error());
}
}
?>
本站原创转载注明:www.111cn.net/phper/php.html