October 22, 2024
Chicago 12, Melborne City, USA
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

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video