We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.
Forum Discussion
travis h.4
9 years agoNew member | Level 1
Java dropbox GUI
How would one go about creating a uploadFile method in Java that has a GUI? for example I am trying to use JFileChooser to execute a selected file in which I can click on the file and call the file a...
travis h.4
9 years agoNew member | Level 1
I should highlight also that I'm not trying to focus on the GUI question I am having success with that portion its just simply this bit of code hanging me up...
public void uploadFile() throws FileNotFoundException, DbxException, IOException{
fc = new JFileChooser();
fc.setMultiSelectionEnabled(true);
//fc.setFileSelectionMode();
int dialog = fc.showSaveDialog(this);
if (dialog == JFileChooser.APPROVE_OPTION) {
inputFile = fc.getSelectedFile();
inputFile.getAbsoluteFile();
try{
FileInputStream inputStream = new FileInputStream(inputFile);
// this is where its not uploading all the code above is running fine
uploadedFile = client.uploadFile(homeDir,
DbxWriteMode.add(), inputFile.length(), inputStream);
String sharedUrl = client.createShareableUrl(homeDir);
System.out.println("Uploaded: " + uploadedFile.toString() + " URL " + sharedUrl);
} catch (IOException e){
}
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,875 PostsLatest Activity: 47 minutes agoIf 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 or Facebook.
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!