OiO.lk Blog PHP Dropbox – createSharedLinkWithSettings return null
PHP

Dropbox – createSharedLinkWithSettings return null


I’m trying to get the url from the dropbox function: createSharedLinkWithSettings, the problem is that it returns me: null
I have the dropbox free plan, could that be why?
However I’m working on Laravel 10.
Thank you.

public function generateSharedLink($file)
{
    $client = new Dropbox(env('DROPBOX_TOKEN'));
    try {
        $sharedLink = $client->createSharedLinkWithSettings($file, [
            'settings' => [
                'requested_visibility' => 'public',
            ],
        ]);
        return $sharedLink['url'];
    } catch (\Exception $e) {
        // Gestisci gli errori, come il file non trovato o l'errore di accesso
        return null;
    }
}



You need to sign in to view this answers

Exit mobile version