//获取上传token
Vendor('sdk.autoload');
$accessKey='********';
$secretKey='*******';
$auth=new \Qiniu\Auth($accessKey,$secretKey);
$token=$auth->uploadToken('***');
//此路径为绝对路径
$filePath =$path;
// 上传到七牛后保存的文件名
$key = 'ceshi.txt';
$uploadMgr = new \Qiniu\Storage\UploadManager();
list($ret, $err) = $uploadMgr->putFile($token, $key, $filePath);
if ($err !== null) {
$res['content']=$err;
$res['error'] = 201;
} 
else 
{
 //进行入库
 $res['content']='成功';
 $res['error']= 200;
}

相关文章:

  • 2021-11-20
  • 2021-11-19
  • 2021-05-21
  • 2021-10-29
  • 2022-12-23
  • 2021-12-24
  • 2021-07-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-24
  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
  • 2021-04-21
相关资源
相似解决方案