phpSDK最新版uploadToken加了key出错
require_once "qiniuSDK/autoload.php";
use Qiniu\Auth;
use Qiniu\Storage\UploadManager;
$accessKey = 'Access_Key ';
$secretKey = 'Secret_Key ';
$auth = new Auth($accessKey, $secretKey);
$bucket = 'image';
$key=$_GET['type'];
$policy = array(
'returnUrl' => 'http://127.0.0.1:808/qiniu/fileinfo.php',
'mimeLimit'=>'image/*',//限制上传格式
);
$token = $auth->uploadToken($bucket,$key, 3600, $policy);
//$token = $auth->uploadToken($bucket,null, 3600, $policy);这样就可以执行
$uploadMgr = new UploadManager();
报错:127.0.0.1:808/qiniu/fileinfo.php?code=403&error=key+doesn%27t+match+with+scope
请问这要怎么解决?
找到问题了,原来是form表单里忘记加key了。uploadToken要带key值表单中就一定要有<input name='key' value=''>