I'm struggling a bit with the syntax of Orbeon/XForms. I'm trying to create a form from which you can upload a file and save it locally on the disk then make it available for download. Or better, display the contents of a directory from the disk and make the files downloadable.
The idea is to upload xml files and then a process in the background converts them to different formats and make those available for download.
Until now, I have this:
<xf:upload ref=".">
<xf:filename>file:////home/me/data-in/*.xml</xf:filename>
<xf:mediatype>text/xml</xf:mediatype>
</xf:upload>
<br/>
<xf:output ref=".">
<xf:label>File: </xf:label>
</xf:output>
The problem is that the file is not stored where I would have wanted to be saved (file:////home/me/data-in/*.xml) but instead in /home/me/apache-tomcat-7.0.57/temp and with a different name.
Can anyone give me some ideas, examples?
Thank you!
I assume the "disk" you referring to is the one the server, not the one on the user's side.
It's not possible to choose the location: all uploaded files are temporary files. Generally, the XForms engine doesn't have direct access to the filesystem.
This said, if you just want to do an upload/download, try the File Attachment control, for example here.
If you want to use it "by hand":
<fr:attachment ref="my-data" xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
<xf:label>Attached file</xf:label>
<!-- Optional -->
<xf:filename ref="@filename"/>
<xf:mediatype ref="@mediatype"/>
<xxf:size ref="@size"/>
</fr:attachment>
This control provides you with a built-in Download link.