在七牛回调的中,是否有返回文件大小属性。属性是什么
程序员文章站
2022-04-14 23:38:24
...
请输入代码
回复内容:
请输入代码
上传策略的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;