$file=$request->file('pic');
$filePath=$file->getRealPath();
$extension=$file->getClientOriginalExtension();
$new_path=md5($filePath.time().'.'.$extension);
$accessKey ="";
$secretKey = "";
$bucket = "";
// 构建鉴权对象
$auth = new Auth($accessKey, $secretKey);
// 生成上传 Token
$token = $auth->uploadToken($bucket);
// 要上传文件的本地路径
// 上传到存储后保存的文件名
// 初始化 UploadManager 对象并进行文件的上传。
$uploadMgr = new UploadManager();
// 调用 UploadManager 的 putFile 方法进行文件的上传。
list($ret, $err) = $uploadMgr->putFile($token, $new_path, $filePath);
composer require qiniu/php-sdk