We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
jimb0p
9 years agoNew member | Level 2
get shared Link of Uploaded Folder
Hi,
I can upload my files with:
public void uploadFileToDropbox(File inputFile, String path, String fileName) throws Exception{
InputStream inputStream = new FileInputStream(inputFile);
try {
FileMetadata uploadedFile = client.files().uploadBuilder("/"+path+"/"+fileName).uploadAndFinish(inputStream);
System.out.println("Uploaded to Dropbox: " + uploadedFile.getName());
} finally {
inputStream.close();
}
}How can I get the URL of the folder? I tried this:
public String getShareLink(String path) throws DbxException{
SharedLinkMetadata slm = client.sharing().createSharedLinkWithSettings(path);
return(slm.getUrl());
}But I always get:
java.lang.IllegalArgumentException: String 'path' does not match pattern
Changed the URL Line like that:
SharedLinkMetadata slm = client.sharing().createSharedLinkWithSettings("/"+path);
2 Replies
Replies have been turned off for this discussion
- jimb0p9 years agoNew member | Level 2
Changed the URL Line like that:
SharedLinkMetadata slm = client.sharing().createSharedLinkWithSettings("/"+path); - Greg-DB9 years ago
Dropbox Community Moderator
I'm glad to hear you already sorted this out. That's correct, non-root file paths need a leading '/'.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!