cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done 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: 

uploading file to dropbox unauthorized access denied

uploading file to dropbox unauthorized access denied

melium
Helpful | Level 6

i get this error

System.UnauthorizedAccessException: Access to the path '/data/data/AndroidMaster.AndroidMaster/files' is denied.

 

public void FileUploadToDropbox()
        {
            string fileSource = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            using (var dbx = new DropboxClient(token"))
            using (var fs = new FileStream(fileSource, FileMode.Create, FileAccess.Read))
            {
                var updated = dbx.Files.UploadAsync(("data.db3"), WriteMode.Overwrite.Instance, body: fs);
            }
        }
1 Accepted Solution

Accepted Solutions

Re: uploading file to dropbox unauthorized access denied

melium
Helpful | Level 6

my working code

void Upload()
        {
            using (DropboxClient dbx = new DropboxClient("token"))
            {
                
                string file = "/data.db3";
                byte[] byteArray = File.ReadAllBytes(@"/data/data/AndroidMaster.AndroidMaster/files/data.db3");
                MemoryStream stream1 = new MemoryStream(byteArray);
                var updated = dbx.Files.UploadAsync(file, WriteMode.Overwrite.Instance, body: stream1);

            }

        }

View solution in original post

3 Replies 3

Re: uploading file to dropbox unauthorized access denied

Greg-DB
Dropboxer
The error message seems to be indicating that your app isn't allow to access the local path (not the remote Dropbox path). That being the case, this seems to be more of an Android issue, so I'm afraid I can't offer much insight. You'll need to look in to why your app can't access that local file path, or if that's not the right path, what is.

Re: uploading file to dropbox unauthorized access denied

melium
Helpful | Level 6
thx for replying man, i got it working. ill post my code here

Re: uploading file to dropbox unauthorized access denied

melium
Helpful | Level 6

my working code

void Upload()
        {
            using (DropboxClient dbx = new DropboxClient("token"))
            {
                
                string file = "/data.db3";
                byte[] byteArray = File.ReadAllBytes(@"/data/data/AndroidMaster.AndroidMaster/files/data.db3");
                MemoryStream stream1 = new MemoryStream(byteArray);
                var updated = dbx.Files.UploadAsync(file, WriteMode.Overwrite.Instance, body: stream1);

            }

        }

View solution in original post

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    melium Helpful | Level 6
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?