Image Uploader allows to limit files not only by type, but also by size and total number. It is extremely useful when you want to allocate limited space on your server for users.
To limit the maximum and minimum numbers of files allowed for the upload in a single upload session, use the MaxFileCount and MinFileCount properties respectively. If the users select more files than specified by the MaxFileCount property, they get an error message (which can be customized using the MessageMaxFileCountExceededText property). If the user selects less files than the MinFileCount property value the Send button is disabled and files cannot be uploaded.
To remove both limitations, set MaxFileCount to
0 and MinFileCount to
You can set a limitation not only for total size of the files selected for the upload, but also for a single file size. Both lower and upper limitations can be specified. Use the MinFileSize and MaxFileSize properties respectively. Too large or too small files cannot be selected: depending on the control layout and its view mode either error message is displayed (as specified with the MessageFileSizeIsTooSmallText and MessageMaxFileSizeExceededText properties) or appropriate items are marked as too large or too small in the folder pane (captions are designated using the FileIsTooSmallText and FileIsTooLargeText properties).
Both these properties should be set to
0 when no file size limitations are
To set a limit on a total size of files selected for the upload, Image Uploader exposes the MaxTotalFileSize property. When the sum of selected file sizes exceeds this value, an error message is displayed. This error message can be modified with the MessageMaxTotalFileSizeExceededText property.
If you do not need to restrict the total file size, set MaxTotalFileSize to
This limitation is applied only to sizes of original files. It does not take into account sizes of thumbnails generated by Image Uploader. Therefore, the actual upload size may noticeably differ from this value. If it is important to limit the POST request size (rather than total size of uploaded files), the only way to do it is to configure maximum acceptable POST request length in the server settings.
As limitations specified in Image Uploader are checked only on the client side, you should not interpret them as a reliable protection. A potential malicious user can bypass all these limitations (by emulating Image Uploader or modifying its parameters in a local copy of a page). That is why it is highly recommended to implement server-side verification of uploaded files in addition to Image Uploader file tests.
In other words, all limitation features discussed in this topic should be used solely for the convenience of the user. They should not be interpreted as a serious protection from malicious users.