Attach Large Files

XWiki Standard has a new file-system attachment storage allowing you to add very large attachments to the wiki documents. This feature is disabled by default, but you can enable it by editing the xwiki.cfg file and by making the following changes under the Storage section:

#-# The attachment storage.

#-# The attachment versioning storage. Use 'void' to disable attachment versioning.

#-# The attachment recycle bin storage

In order for the changes to be taken into account, you will have to restart the server.

Next, you need to set the maximum size of the attachment. To do that, just edit the XWiki.XWikiPreferences page in "Objects" mode (e.g. ServerName/xwiki/bin/edit/XWiki/XWikiPreferences?editor=object) and replace the value of the "Maximum Upload Size" property with a huge number (for instance "999999999999").


Store Attachments on the Filesystem

In order to move the attached files from the database to the file-system, you can use the "Filesystem Attachment Porter" tool available here. You just have to download the snippet, edit it and copy the code in any wiki page, for instance in "XWiki.FSPorter".

The first step is to enable the file-system attachment storage as explained in the above section, then to restart the server. If the configuration is correct, when you navigate to "XWiki.FSPorter" you should see the following 3 lines colored in green:



The attachments will be copied from the database into the permanent directory set for the servlet container. 

Note that the file-system porter will copy the attachments from the database to the storage folder but it will not delete the entries from the database. It is recommended to keep the attachments in the database that after the copy process finishes.

The "Dry Run" option allows you to do a simulation in order to check for corrupted attachments without necessarily having the file-system storage enabled.

The "Verbose" option displays each attachment as it is processed. 

Once you click the "Start" button, the script will work in 20 second chunks and print the results of each chunk. In order for the script to switch to the next chunk you will have to click the "Continue" button.



Related Pages

Trying to decide between Cloud and On Premise? See the comparison on the XWiki Help Center.

Search this space