Laravel-Dropbox驱动程序-该驱动程序不支持检索URL

时间:2019-03-20 08:47:34

标签: dropbox laravel-5.7

使用

Laravel 5.7

我正在尝试使用Dropbox驱动程序上传图像,它可以正常工作..但是当我想要获取URL时,它给我一个错误

This driver does not support retrieving URLs

filesystems.php

'disks' => [

        'dropbox' => [
            'driver'     => 'dropbox',
            'app_secret' => env('DROPBOX_APP_SECRET'),
            'token'      => env('DROPBOX_TOKEN'),
        ],

    ],

UploadController.php

public function postUpload(Request $request)
    {
        $user = Auth::user();
        $file = $request->file('picture');
        $filename=uniqid($user->id."_").".".$file->getClientOriginalExtension();
        Storage::disk('dropbox')->put($filename, File::get($file), 'public');

        $url = Storage::disk('dropbox')->url($filename);
        $user->profile_pic = $url;
        $user->save();

        $user->profile_pic = $filename;
        $user->save();
        return view('upload-complete')->with('filename', $filename)->with('url',$url);
}

upload-complete.blade.php

@extends('template')

@section('content')
<div class="container">
    <h1>File Uploaded</h1>
    <hr />
    <div class="text-center">
       <img src="{{ $url }}" class="img-rounded" />
    </div>

</div>
@endsection

0 个答案:

没有答案