cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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
Go to solution

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

melium
Helpful | Level 6
Go to solution

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

Greg-DB
Dropbox Staff
Go to solution
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.

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

melium
Helpful | Level 6
Go to solution

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);

            }

        }
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    melium Helpful | Level 6
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?