Seven Qiniu storage-seven kn: PHP generates issues with multiple policy tokens

Source: Internet
Author: User
I've been like this before. Generate seven tokens for cattle:

    $bucket = "";     //你的七牛云存储的空间名称    $accessKey = '';  //公钥    $secretKey = '';  //密钥    Qiniu_SetKeys($accessKey, $secretKey);    $putPolicy = new Qiniu_RS_PutPolicy($bucket);    //生成token    $token = $putPolicy->Token(null);

Now I want to put a little more strategy, than the size of the picture, rename the image, allow uploading of file types, and so on, I constructed such a method:

$policy= array(    "scope"=>"",          //存储的空间名称    "saveKey"=>"",        //重命名    "fsizeLimit"=>"",     //文件大小    "mimeLimit"=>""       // 文件类型");$accessKey = ''; //公钥$secretKey = ''; //密钥Qiniu_SetKeys($accessKey, $secretKey);$putPolicy = new Qiniu_RS_PutPolicy($policy);//把策略放这里//生成token$token = $putPolicy->Token(null);

Now, I have trouble, this is not generated token, and the first method, I was a successful generation of token, I would like to download the PHP JDK to deal with this problem, but it seems I did not understand, I ask who can help me?

Reply content:

I've been like this before. Generate seven tokens for cattle:

    $bucket = "";     //你的七牛云存储的空间名称    $accessKey = '';  //公钥    $secretKey = '';  //密钥    Qiniu_SetKeys($accessKey, $secretKey);    $putPolicy = new Qiniu_RS_PutPolicy($bucket);    //生成token    $token = $putPolicy->Token(null);

Now I want to put a little more strategy, than the size of the picture, rename the image, allow uploading of file types, and so on, I constructed such a method:

$policy= array(    "scope"=>"",          //存储的空间名称    "saveKey"=>"",        //重命名    "fsizeLimit"=>"",     //文件大小    "mimeLimit"=>""       // 文件类型");$accessKey = ''; //公钥$secretKey = ''; //密钥Qiniu_SetKeys($accessKey, $secretKey);$putPolicy = new Qiniu_RS_PutPolicy($policy);//把策略放这里//生成token$token = $putPolicy->Token(null);

Now, I have trouble, this is not generated token, and the first method, I was a successful generation of token, I would like to download the PHP JDK to deal with this problem, but it seems I did not understand, I ask who can help me?

Look at your code, it should be the 6.x version of the SDK, and the way to set the upload strategy is the 7.x version of the method, so there will certainly be a problem.

6.x version of the PHP SDK documentation can refer to http://developer.qiniu.com/docs/v6/sdk/legacy-php-sdk.html

In addition one modifies here as below this should be possible:

$bucket = "";$putPolicy = new Qiniu_RS_PutPolicy("$bucket");$putPolicy->SaveKey = "";$putPolicy->FsizeLimit = "";$putPolicy->MimeLimit= "";$accessKey = ''; //公钥$secretKey = ''; //密钥Qiniu_SetKeys($accessKey, $secretKey);$upToken = $putPolicy->Token(null);echo $upToken;
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.