<code>请输入代码</code>
<code>请输入代码</code>
上传策略的callbackBody字段设置fsize这个魔法变量即可:
http://developer.qiniu.com/docs/v6/api/overview/up/response/vars.html#magicvar
php的话就是生成token的地方
<code> $bucket = Config::BUCKET_NAME; $accessKey = Config::ACCESS_KEY; $secretKey = Config::SECRET_KEY; $auth = new Auth($accessKey, $secretKey); $policy = array( 'callbackUrl' => 'http://172.30.251.210/callback.php', 'callbackBody' => '{"fname":"$(fname)", "fsize":"$(fsize)", "fkey":"$(key)", "desc":"$(x:desc)", "uid":' . $uid . '}' ); $upToken = $auth->uploadToken($bucket, null, 3600, $policy); header('Access-Control-Allow-Origin:*'); echo $upToken;</code>