$data=$_POST;
$file=$_FILES;
$pathname=__DIR__ . '/../web/uploads/'.md5(rand(100003,156545645).rand(1564564,9999999).time()).".jpg";
move_uploaded_file($file['image']['tmp_name'],$pathname);
$url="http://file.api.weixin.qq.com/cgi-bin/media/upload";
$curl=new Curl();
$access_token=Yii::$app->redis->get($this->tokenname);
$param=array('access_token'=>$access_token,'type'=>$data['zhan']);
$curl->setGetParams($param);
$curl->setOption(CURLOPT_SSL_VERIFYPEER,false);
$curl->setOption(CURLOPT_SSL_VERIFYHOST,false);
$filedata = array (
'media' => new \CURLFile ( realpath ( $pathname ), 'image/jpg')
);
$curl->setRawPostData($filedata);
$res=$curl->post($url,false);
var_dump($res);die;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form action="?r=weitwo/add-meaid" method="post" enctype="multipart/form-data">
<select name="zhan">
<option value="image">照片</option>
<option value="voice">录音</option>
<option value="video">视频</option>
<option value="thumb">缩略图</option>
</select>
<input type="file" name="image">
<input type="submit">
</form>
</body>
</html>