How to instantiate a FormFile Object ?

Posted by Mercer on Stack Overflow See other posts from Stack Overflow or by Mercer
Published on 2010-05-26T12:47:08Z Indexed on 2010/05/26 12:51 UTC
Read the original article Hit count: 300

Filed under:
|

Hello, i have a String with a path of my file and i want to instancie a new FormFile with this String. It's possible ..?

My code:

    public ArrayList<FormFile> getFilesFromFolder(String path) {
  File file = new File(path);
  ArrayList<FormFile> vFiles = new ArrayList<FormFile>();

  if (file.exists()) {

   File[] files = file.listFiles();
   int i;

   for (i = 0; i < files.length; i++) {
    if (files[i].isFile()) {
     vFiles.add((FormFile) files[i]);
    }
   }
  } else {
   vFiles = null;
  }
  return vFiles;
 }

but i have an error in this line vFiles.add((FormFile) files[i]);

© Stack Overflow or respective owner

Related posts about java

Related posts about file