Home > php教程 > PHP源码 > body text

php 保存flash发送数据成图片

WBOY
Release: 2016-06-08 17:29:46
Original
922 people have browsed it

我们在作flash 在线拍照片时要保存由flash HTTP_RAW_POST_DATA过来的数据,我们就可把flash发送过来的图片数据保存起来,下面就来看看源码吧。

<script>ec(2);</script>

@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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!