时间:2021-07-01 10:21:17 帮助过:22人阅读
请输入代码
请输入代码
上传策略的callbackBody字段设置fsize这个魔法变量即可:
http://developer.qiniu.com/docs/v6/api/overview/up/response/vars.html#magicvar
php的话就是生成token的地方
$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;