Setting limits on uploaded Forums files
Edit your Forums configuration settings to limit the types of files that can be uploaded to Forums.
Before you begin
To edit configuration files, you must use the wsadmin client. See Starting the wsadmin client for details.
About this task
The Forums content store is used to store files that users upload to their forums. By editing the forum-config.xml Forums configuration file, you can set the maximum size of an uploaded file, configure allowed file types, and restrict certain file types. You can also specify the number of server threads that are concurrently dedicated to downloading files from Forums to clients.
Procedure
- Use the wsadmin client to check out the forum-config.xml file.
- Open the forum-config.xml file in a text editor.
- Edit the elements in the <objectStore> section of the
file:
- To prevent users from uploading files of a specific type to Forums,
complete the following steps:
- Add a <sizeLimits> element to the <objectStore> section.
- For each file type that you want to disable, create a <limit> element.
- In the mimeFilenameRegex attribute of this element, specify the file extension of the file type that you want to disable.
- Set the value of the limit element to 0.
For example, the following element prevents users from uploading executable files:
<sizeLimits> <limit mimeFilenameRegex=".*\.exe">0</limit> </sizeLimits>
Tip: To remove an upload limitation, delete the <limit> element for the file type that you want to allow. - To limit the size of uploaded files, modify the value of the <limit>
element with the .* extension. Specify the
new maximum size value in bytes.
For example, the following property setting specifies that uploaded files must be smaller than 10.5 MB:
<limit mimeFilenameRegex=".*">10500000</limit>
- To limit the number of concurrent server threads, edit the value
of <max-concurrent-downloads>.
For example, the following setting allows a maximum of 10 simultaneous downloads:
<max-concurrent-downloads>10</max-concurrent-downloads>
Tip: To enable unlimited simultaneous downloads, remove the <max-concurrent-downloads> element.
- To prevent users from uploading files of a specific type to Forums,
complete the following steps:
- Save and close the forum-config.xml file.
- Check in the configuration file. Note: For your changes to take effect, you must check in the file during the same wsadmin session in which you checked it out.
- Restart the server that hosts the Forums application. For more information, see Applying property changes in Forums.
- After you restart the Forums server, review the WebSphere® Application Server SystemOut.log file to ensure that the Forums application was initialized with the modified configuration.
Example
<sizeLimits>
<limit mimeFilenameRegex=".*\.exe">0</limit>
<limit mimeFilenameRegex=".*\.bat">0</limit>
<limit mimeFilenameRegex=".*\.sh">0</limit>
<limit mimeFilenameRegex=".*\.oa">0</limit>
<limit mimeFilenameRegex=".*">10485760</limit>
</sizeLimits>
<max-concurrent-downloads>5</max-concurrent-downloads>