cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Upload content to shared file

Upload content to shared file

mau21mau
Explorer | Level 3

We currently use Dropbox's Python SDK to overwrite existing file contents with the method .files_upload(). With give it the file id as a parameter along with the file content and it works:

 

client.files_upload(
file_contents,
file_id,
mode=WriteMode.overwrite
)

 The problem is that, if the file is a shared one, it won't work. Is it even possible?

4 Replies 4

Greg-DB
Dropbox Staff

Can you clarify what you mean when you say "it won't work"? What error/output do you get?

 

You should be able to use this method to upload to an existing file by specifying the file ID, even if it's in a shared folder, for instance, as long as the file is in the connected account and the account has write access.

mau21mau
Explorer | Level 3

But what if the file is stored at root? Or what if someone shared only the file and not its parent folder necessarily? I have simulated two cases. One which the file is shared with me, but it's stored at the owner's root folder. The other file is stored at a folder which I don't have access to the folder, only the file. In both cases I get the following error:

dropbox.exceptions.ApiError: ApiError('dc54baf177204ec09c535d47a46e21b2', UploadError('path', UploadWriteFailed(reason=WriteError('no_write_permission', None), upload_session_id='AAAAAAAAAkihHB-Mp2VFBg')))

 

Greg-DB
Dropbox Staff

The location within the account doesn't really matter, but which account it is in does matter. From your description, it sounds like the file is not in the connected account (that is, the account for the access token you're using), but rather is in another account (and the file just happens to be shared individually to the connected account).

 

Since the file is not actually in the connected account, the connected account does not have the ability to write to it, resulting in this 'no_write_permission' error.

mau21mau
Explorer | Level 3

You are right.  The file belongs to another account, which have shared the file with the connected account. The thing is that, the connected account does write to the file if it is in a shared folder as you said. In my case, only the file is shared with the connected account, while the file's parent folder is not, so it doesn't work. Another issue is that if the file resides in the root folder of the owner, it doesn't belong to a sharable folder. So in order for the users of our App send data between shared files, they must be in a shared folder as well.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    mau21mau Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?