public function uploadFilePrivate(Request $request)
    {
        $file = array_get($request, 'file', '');
        if (empty($file)) {
            return $this->responseJson([], -1, '文件不能为空');
        }

        $data = [
            'file' => new \CURLFile($file->getPathname(), $file->getClientMimeType(), $file->getClientOriginalName()),
        ];

        try {
            $result = Gateway::tool('/v1/file/private', $data, 'POST');
            $result['origin_name'] = $file->getClientOriginalName();
            return $this->responseJson($result);
        } catch (\Exception $e) {
            return $this->responseJson([], '-1', '上传失败');
        }
    }

 

相关文章:

  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-20
  • 2021-09-10
  • 2021-11-04
  • 2022-12-23
  • 2021-08-04
相关资源
相似解决方案