Search code examples
dropboxdropbox-apidropbox-php

Dropbox api upload to root directory?


I'm using dropbox-php-sdk and i cannot upload to root directory(team), i can only upload to account directory? Instead of uploading to home/Movies, it is uploading to home/Dave Smith/home/Movies?

       //Configure Dropbox service
        $dropbox = new Dropbox($app);

        //Chunk Size
        $chunkSize = 8000000;

        $pathToLocalFile = '/home/mywebsite/public_html/assets/videos/input3.mp4';

        // Automatically create stream through file path
        $dropboxFile = new DropboxFile($pathToLocalFile);

        $file = $dropbox->uploadChunked($dropboxFile, "/home/Movies/input3.mp4", null, $chunkSize);

My dropbox account has full dropbox permissions to access all files/folders in teamspace. The app/access token was created by team admin account. How do i solve?


Solution

  • By default, Dropbox API calls operate in the "member folder" ("/Dave Smith" in your example).

    You can configure Dropbox API calls to operate in the "team space" instead though, by setting the Dropbox-API-Path-Root header. You can find information on using that in the Team Files Guide.