Home >Backend Development >PHP Tutorial >在七牛回调的中,是否有返回文件大小属性。属性是什么

在七牛回调的中,是否有返回文件大小属性。属性是什么

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 20:28:501396browse

<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>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn