Hello!
For example, I have an attachment to xwiki page. How is possible to get (via velocity or groove script at this page) real full path for this attachment at filesystem?
Thanks beforehand!
There is no public API to do that but if it’s a short term need you can use one of the following :
-
the component
org.xwiki.store.filesystem.internal.FilesystemStoreTools
and methodgetAttachmentDir
-
using Groovy (which does not care about public/private), access the private field
storageFile
from the attachment content instance (given byXWikiAttachment#getAttachment_content()
)
Thanks! That is what I need! I will try to use.
Finally I got it!
Need to write (groovy):
rzlt = doc.getAttachment("TestingData.xls").getAttachment().getAttachment_content().storageFile.getAbsolutePath()
I added snippet at
https://snippets.xwiki.org/xwiki/bin/view/Extension/Get%20physical%20path%20on%20server%20of%20an%20attachment/
Thanks ! I added a warning.