0

I am able to upload image to Dropbox but I would like to get uploaded file path so I am able to keep the path for future references.

I have uploaded by

FileInputStream fis = new FileInputStream(mFile);
        String path = mPath + mFile.getName();
        mRequest = mApi.putFileOverwriteRequest(path, fis, mFile.length(),
                new ProgressListener() {
                    @Override
                    public long progressInterval() {
                        // Update the progress bar every half-second or so
                        return 500;
                    }

                    @Override
                    public void onProgress(long bytes, long total) {
                        publishProgress(bytes);
                    }
                });

        if (mRequest != null) {
            mRequest.upload();
            return true;
        }

Please help me how to do this in Android

Satyaki Mukherjee
  • 2,857
  • 1
  • 22
  • 26

1 Answers1

0

The upload method you're using returns a DropboxAPI.Entry.

You can read the path from that returned object, which would be the path of the uploaded file in this case.

Also, note that this Dropbox Android Core SDK uses Dropbox API v1, which is deprecated:

https://blogs.dropbox.com/developers/2016/06/api-v1-deprecated/

You should migrate to the API v2 SDK:

https://www.dropbox.com/developers/documentation/java

Greg
  • 16,359
  • 2
  • 34
  • 44
  • How to get path from rev object? Please tell me. Api v2 in java, so it's not properly available in android, may be I am wrong – Satyaki Mukherjee Nov 29 '16 at 18:32
  • You can use the API v2 Java SDK for Android. There's a sample app here: https://github.com/dropbox/dropbox-sdk-java/tree/master/examples/android If you're using that, and are having trouble, open a new post with the code and problem you're running in to. – Greg Nov 29 '16 at 18:36
  • this path not the shared link path. I need shared link path. I cannot move on API v2 right now, because all the things build on, only this portion remain. Please help me – Satyaki Mukherjee Nov 30 '16 at 13:50
  • If you need a shared link for a file, you can create one by calling [`createSharedLinkWithSettings`](https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.1.x/com/dropbox/core/v2/sharing/DbxUserSharingRequests.html#createSharedLinkWithSettings-java.lang.String-), or retrieve an existing one via [`listSharedLinksBuilder`](https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.1.x/com/dropbox/core/v2/sharing/DbxUserSharingRequests.html#listSharedLinksBuilder--). – Greg Nov 30 '16 at 16:06