Èç¹uÒªÔÚphpÖÐʵÏÖÊÓƵÅÄÕÕÎÒÃÇÐeÒª½eÖuÓÚflash²a¼þÁË£¬ÓÉflashÅijoµÄÈÕÕƬÎÒÃÇÔÙͨ¹ýphpµÄ$GLOBALS ['HTTP_RAW_POST_DATA']½ÓÊÜÊý¾Ý£¬È»ºo±£´ae³ÉͼƬ¾Í¿ÉÒÔÁË£¬ÏÂÃaeÎÒÀ´½eÉÜһϡ£
ʹÓõÄÊÇ$GLOBALS ['HTTP_RAW_POST_DATA']£¬Õa¸oϵͳº¯Êý¸upostºÜÏaËÆ£¬µ«ÊÇ$GLOBALS ['HTTP_RAW_POST_DATA']Ö§³ÖµÄÊý¾Ý¸ñʽ¸ua¸»Ð(C)¡£
Ée¼ÆÁ÷³Ì£º
$GLOBALS ['HTTP_RAW_POST_DATA']´«µÝÕÕƬÊý¾ÝÁ÷£¨¶þ½øÖÆ£(C)¨C>´o¿ªÒ»ÕÅ¿Õ°×ͼ¡ª>°ÑÊý¾ÝÁ÷д½ø¿Õ°×ͼƬÀiÃae¨CÅжÏÊÇñÊÇÓÐЧͼƬ¡ªÍe³É¡£
×¢Òa´«µÝÕÕƬµÄ¶þ½øÖÆÁ÷ÒѾ°uº¬ÕÕƬµÄ³ß´ç´oС£¬¸ñʽµÈµÈÊoÐÔ£¬Ê±¼aÉϾÍÊÇ°ÑÊÖ»uͼƬÐÅÏ¢´«µÝµ½web¶ËÒ³Ãae¡£
ÊÖ»u¶ËÒ»°aʹÓÃflashÇиiÕÕƬ´oС£¬´o¼Ò¶¼ÖªµÀͼƬºÍÊÓƵÊÇÓɶþ½øÖÆÁ÷×e³ÉµÄ£¬¼ÈȻͼƬ¿ÉÒÔÉÏ´«£¬ÄÇôÊÓƵÄܲ»ÄÜÉÏ´«ÄØ£¿ÔÀiÊDz»ÊǺÍÊÖ»uÅÄÕÕÉÏ´«ÍÏñÒ»ÑuÄØ£¿×Ô¼º¿ÉÒÔÈ¥Ñо¿Ò»Ï¡£
´uÂeÈçÏÂ
/*
* ÉÏ´«Í¼Æ¬Àa
* @parameter; Óû§ID
* @date£º2015-10-08
* @author£ºcy
* */
function UpImg($subdir){
// ÉeÖôae´¢Â*¾¶
if(!empty($subdir)){
$dirnow=getcwd();
$folder =$dirnow."/www.php100.com/".$subdir;// folder where to save images
if( !is_dir($folder) ) mkdir($folder);
// ͼƬÃuÃu
$datenow=date('Ymd');
$timenow=time();
$image = $datenow.$timenow.'.jpg';
// ͼƬÊÇ*ñÒÑ´aeÔÚ
$check = $folder . '/' . $image;
if (file_exists($check)) {
unlink($check);
} else {
$png = file_get_contents ( 'php://input' ) ? file_get_contents ( 'php://input' ) : gzuncompress ( $GLOBALS ['HTTP_RAW_POST_DATA'] );//µÃµ½post¹ýÀ´µÄ¶þ½øÖÆÔʼÊý¾Ý
if(!empty($png)){
$file = @fopen($folder."/".$image, "w");
fwrite($file,$png);//дÈe hzhuti.com
fclose($file);//¹Ø±Õ
// orignal image location
$write_image = $folder . '/' . $image;
}else{
$msg = "ûÓÐÊý¾ÝÁ÷";
}
if(getimageInfo($write_image)){
$msg = "ÉÏ´«³É¹¦";
}else{$msg = "ͼƬ¸ñʽ²»ÕýÈ*";}
}
}else{
$msg = "²ÎÊý´iÎo";
}
return $msg;
}
/*
* ¼i²aͼƬÊÇ*ñºÏ*¨
* @parameter; ÎļþÃu
* @date£º2011-8-15
* @author£ºcy
* */
function getimageInfo($imageName = '') {
$imageInfo = getimagesize ( $imageName );
if ($imageInfo !== false) {
$imageType = strtolower ( substr ( image_type_to_extension ( $imageInfo [2] ), 1 ) );
// $imageSize = filesize ( $imageInfo );
return $info = array ('width' => $imageInfo [0], 'height' => $imageInfo [1], 'type' => $imageType, 'mine' => $imageInfo ['mine'] );
} else {
//²»ÊÇ php100.com ºÏ*¨µÄͼƬ
return false;
}
}
ÔÚʹÓÃxml-rpcµÄʱºo£¬server¶Ë»ñÈ¡clientÊý¾Ý£¬Ö÷ÒªÊÇͨ¹ýphpÊaÈeÁ÷input£¬¶ø²»ÊÇ$_POSTÊý×e
¸u¾ÝÉÏÃae¼¸¸o̽²a£¬ÎÒÃÇ¿ÉÒÔ×÷³oÒÔÏÂ×ܽa:
1¡¢Content-TypeȡֵΪapplication/x-www-form-urlencodedʱ£¬php»a½«httpÇeÇobodyÏaÓ¦Êý¾Ý»a ÌiÈeµ½Êý×e$_POST£¬ÌiÈeµ½$_POSTÊý×eÖеÄÊý¾ÝÊǽøÐÐurldecode()½aÎoµÄ½a¹u¡££¨Æaʵ£¬³ýÁ˸ÃContent-Type£¬»¹ÓÐ multipart/form-data±iʾÊý¾ÝÊDZiµ¥Êý¾Ý£¬ÉÔºoÎÒÃǽeÉÜ£(C)
2¡¢php://inputÊý¾Ý£¬Ö»ÒªContent-Type²»Îªmultipart/form-data(¸ÃÌo¼þÏÞÖÆÉÔºo»a½eÉÜ)¡£ÄÇôphp: //inputÊý¾ÝÓehttp entity body²¿ÖÊý¾ÝÊÇÒ»Öµġ£¸Ã²¿ÖÏaÒ»ÖµÄÊý¾ÝµÄ³¤¶ÈÓÉContent-LengthÖ¸¶¨¡£
3¡¢½oµ±Content-TypeΪapplication/x-www-form-urlencodedÇÒÌa½»½¨ÊÇPOST½¨Ê±£¬$_POSTÊý¾ÝÓephp://inputÊý¾Ý²ÅÊÇ¡±Ò»Ö¡±£¨´oÉÏÒýºÅ£¬±iʾËuÃǸñʽ²»Ò»Ö£¬ÄÚÈÝÒ»Ö£(C)µÄ¡£ÆaËuÇe¿o£¬ËuÃǶ¼²»Ò»Ö¡£
4¡¢php://input¶ÁÈ¡²»µ½$_GETÊý¾Ý¡£ÊÇÒoΪ$_GETÊý¾Ý×÷Ϊquery_pathдÔÚhttpÇeÇoͲ¿(header)µÄPATH×ֶΣ¬¶ø²»ÊÇдÔÚhttpÇeÇoµÄbody²¿Ö¡£
ÕaÒ²°iÖuÎÒÃÇÀi½aÁË£¬ÎªÊ²Ã´xml_rpc*þÎñ¶Ë¶ÁÈ¡Êý¾Ý¶¼ÊÇͨ¹ýfile_get_contents(¡®php://input', ¡®r')¡£¶ø²»ÊÇ´Ó$_POSTÖжÁÈ¡£¬ÕýÊÇÒoΪxml_rpcÊý¾Ý¹ae¸ñÊÇxml£¬ËuµÄContent-TypeÊÇtext/xml¡£
Ч¹uͼ£º
ÒÔÉϾÍÊǽeÉÜÁËphpÊÇÈçºÎʵÏÖÊÓƵÅÄÕÕÉÏ´«Í*Ïñ¹¦ÄܵÄÈ«²¿ÄÚÈÝ£¬Ï£Íu¶Ô´o¼ÒµÄѧϰÓÐËu°iÖu¡£
Copyright© 2013-2020
All Rights Reserved 京ICP备2023019179号-8