Setting limits on uploaded files
Edit configuration property settings to limit the types of files that can be uploaded into Activities. You can also set the maximum size of an uploaded file and the number of server threads concurrently dedicated to downloading files from Activities to clients.
Before you begin
To edit configuration files, you must use the wsadmin client. See Starting the wsadmin client for details.
About this task
The Activities content store is used to store files that users upload to their activities.
Procedure
- Use the wsadmin client to access and check out the Activities
configuration files.
- From the temporary directory to which you just checked out the oa-config.xml file, open the file in a text editor.
- Edit the elements in the <objectStore> section of the
file to set limits on the files that can be uploaded.
- To prevent users from being able to upload files of a specific
type to Activities, add a <sizeLimits> element block to the <objectStore>
section. For each file type that you want to disable, create a <limit>
element. Set the mimeFilenameRegex attribute of the <limit> element
equal to the file extension of the file type that you want to prevent
users from uploading. Set the value of the limit element to 0. For example,
the following element prevents users from being able to upload executable
files:
<sizeLimits> <limit mimeFilenameRegex=".*\.exe">0</limit> </sizeLimits>
Tip: When you specify a value for the mimeFilenameRegex attribute, you are specifying a regular expression. Regular expressions are normally case-sensitive, and in the 1.0.x releases were treated as such. With release 2.0, the filter was enhanced so it is not case-sensitive. For example, if you specify<limit mimeFilenameRegex=".*\.exe">
, the tool filters any files with a .exe extension regardless of the case in which the letters EXE are specified. - To limit the size of files that are uploaded to the content store, modify the value of the
<limit> element for the entry with the .* extension. Specify the new
maximum size value in bytes. For example, the following property setting specifies that all files
must be smaller than 10
MB:
<limit mimeFilenameRegex=".*">10485760</limit>
- To limit the number of threads that are allowed to concurrently
respond to requests to download files from the content store, edit
the value of <max-concurrent-downloads>. For example, the following
property setting enables the server to allow a maximum of 10 downloads
at the same time:
<max-concurrent-downloads>10</max-concurrent-downloads>
- To prevent users from being able to upload files of a specific
type to Activities, add a <sizeLimits> element block to the <objectStore>
section. For each file type that you want to disable, create a <limit>
element. Set the mimeFilenameRegex attribute of the <limit> element
equal to the file extension of the file type that you want to prevent
users from uploading. Set the value of the limit element to 0. For example,
the following element prevents users from being able to upload executable
files:
- To remove a file upload limitation, delete the <limit> element that represents the file type that you want to allow users to upload.
-
If you configured your system to upload an Activities file through the IBM HTTP Server as
described in Configuring file uploads through IBM HTTP Server, you can edit the value
for the
formFileUploadSizeLimit
parameter to change the maximum file upload size. For example, the following property enables the server to upload a file with a maximum size of 30 MB:<formFileUploadSizeLimit>31457280</formFileUploadSizeLimit>
- To enable unlimited simultaneous downloads, remove the <max-concurrent-downloads> element.
- Save and close the oa-config.xml file.
- After you make changes, check in the configuration file. Check the file in during the same wsadmin session in which you checked it out for the changes to take effect. You must also restart the server. See Applying property changes for details.
- After you restart the Activities server, review the WebSphere® Application Server SystemOut.log file to ensure that the Activities application was able to initialize 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>