This discussion is archived
2 Replies Latest reply: Apr 1, 2008 5:11 AM by 807601 RSS

How to find if the user has selected one or many files using a file chooser

807601 Newbie
Currently Being Moderated
I have a file chooser but want it to return either a file or file array depending on whether more than one file is selected but there doesn't seem to be any way to find out if that is the case or not. I want it to look something like:
            if(fileChooser.getSelectedFile().isDirectory()==true)
            {
                selectedFile=fileChooser.getCurrentDirectory();
            }
            else if(fileChooser.multipleFilesSelected())
            {
                fileChooser.getSelectedFiles();//we have more than one file selected
            }
            else    
            {
                fileChooser.getSelectedFile();    //if we have one file selected
            }
am I going about dealing with this in the right way?