我的php代码:
function get_pic_mediaid($picname=''){
$type="image";
$url ="http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token=%s&type=%s";
$access_token = get_current_access_token();
$url=sprintf($url,$access_token,$type);
        $filepath=  dirname(__FILE__).'/resource/attachment/'.$picname;
$filedata=array("media"=>'@'.$filepath);
$resp=  ihttp_post($url,$filedata);
var_dump($resp);exit;
}
说明:$picname是<input type="file">上传后得到的文件名,上传成功的,$filepath路径上能找到对应的图片