This discussion is archived
4 Replies Latest reply: Apr 24, 2013 7:23 AM by rp0428 RSS

How to get the file path of selected file using JFileChooser

777684 Newbie
Currently Being Moderated
Hi All,
I am trying to store the file on my FTP server after selecting the file from the user workstation using JFileChooser. But I am not able to write the file on FTP server or on user local machine where application is running. I am new to this FTP server coding. Can anyone help me in this.
This is the code I wrote on button click user will able to select the file:

String filename1;
File file;
JFileChooser fc = new JFileChooser();
file = fc.getSelectedFile();
filename1 = file.getPath();

Below is the code to write the file on my local machine first:

BufferedWriter outFile = new BufferedWriter( fileName ) );
outFile.flush( );
outFile.close( );

Any help will be greatly appriciated


  • Correct Answers - 10 points
  • Helpful Answers - 5 points