Example #1
-1
 /**
  * 上传临时素材
  *
  * image 1M, voice 2M, video 10M, thumb 64K     
  * @return boolean | array(type => , media_id => , created_at => )
  */
 public function uploadFile($type, $file)
 {
     static $url = 'http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token=%s&type=%s';
     $token = $this->getAccessToken();
     $body = Utility::http(sprintf($url, $token, $type), array('media' => CURLFile::realpath($file)));
     $json = json_decode($body, true);
     if (!$json || !empty($json['errcode'])) {
         return false;
     } else {
         return $json;
     }
 }