How to instantiate a FormFile Object ?
- by Mercer
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]);