cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We're looking to hear about your experience when using Dropbox in a web browser. What parts of Dropbox feels very slow to you and takes a lot of time to get done? What are you trying to do in the Dropbox web browser when you experience slowness? Tell us 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: 
1
Ask
2
Comments

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

            }

        }
Need more support?