jeff923
jeff923

Reputation: 3

How to get the link to the file after uploading to Google Drive via api?

I am following this guide. I am able to upload images to my google drive but I am not able to get the path to the file.

https://gist.github.com/ivanvermeyen/cc7c59c185daad9d4e7cb8c661d7b89b

// Get img that was uploaded to my server
$img = request()->file('img');

// Save that image to my google drive
Storage::disk('google')->put('img.png', fopen($img, 'r+'));

// ?? how do I get the path to the file so I can save it in my database?

Upvotes: 0

Views: 2126

Answers (1)

PKeidel
PKeidel

Reputation: 2589

Have you looked it up in the laravel documentation?

https://laravel.com/docs/5.5/filesystem#file-urls

For your code you should use this:

use Illuminate\Support\Facades\Storage;

$url = Storage::disk('google')->url('img.png');

dd($url);

Upvotes: 1

Related Questions