|
|
Re: Retriving a FileDocument from a filepath
Olivier Dedieu -
on 2/22/06 at 8:08 PM
You can use channel.getFileIndexedDataSet(). This method returns the set of publication bound to the given path. This set can contains FileDocument but also other publications types which reference the file (e.g. through an "image" field).
Example :
// Get the publication set bound to "picture.jpg"
TreeSet set = channel.getFileIndexedDataSet("upload/image/jpg/picture.jpg");
// Retain only the FileDocuments
set = (TreeSet)Util.interSet(set, channel.getDataSet(FileDocument.class));
if (Util.notEmpty(set)) {
FileDocument fileDoc = (FileDocument)(set.iterator().next());
...
}
|
|