Class UploadHandler.UploadConfig
java.lang.Object
com.wontlost.ckeditor.handler.UploadHandler.UploadConfig
- Enclosing interface:
UploadHandler
Upload configuration
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longDefault maximum file size: 10MBstatic final longMaximum allowed file size: 1GBstatic final longMinimum allowed file size: 1 byte -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAllowedMimeTypes(String... mimeTypes) Add additional MIME types to the allowed listString[]Get allowed MIME typeslongGet maximum file sizeReset to the default MIME types listsetAllowedMimeTypes(String... allowedMimeTypes) Set allowed MIME types.setMaxFileSize(long maxFileSize) Set maximum file sizevalidate(UploadHandler.UploadContext context) Validate an upload against this configuration
-
Field Details
-
MIN_FILE_SIZE
public static final long MIN_FILE_SIZEMinimum allowed file size: 1 byte- See Also:
-
MAX_FILE_SIZE_LIMIT
public static final long MAX_FILE_SIZE_LIMITMaximum allowed file size: 1GB- See Also:
-
DEFAULT_MAX_FILE_SIZE
public static final long DEFAULT_MAX_FILE_SIZEDefault maximum file size: 10MB- See Also:
-
-
Constructor Details
-
UploadConfig
public UploadConfig()
-
-
Method Details
-
getMaxFileSize
public long getMaxFileSize()Get maximum file size- Returns:
- maximum file size in bytes
-
setMaxFileSize
Set maximum file size- Parameters:
maxFileSize- maximum file size in bytes, must be between 1 byte and 1GB- Returns:
- this
- Throws:
IllegalArgumentException- if maxFileSize is outside the valid range
-
getAllowedMimeTypes
Get allowed MIME types- Returns:
- a copy of the MIME types array
-
setAllowedMimeTypes
Set allowed MIME types. Setting to an empty array allows all MIME types.- Parameters:
allowedMimeTypes- MIME types array- Returns:
- this
- Throws:
IllegalArgumentException- if the array is null or contains null/empty strings
-
addAllowedMimeTypes
Add additional MIME types to the allowed list- Parameters:
mimeTypes- MIME types to add- Returns:
- this
-
resetAllowedMimeTypes
Reset to the default MIME types list- Returns:
- this
-
validate
Validate an upload against this configuration- Parameters:
context- upload context- Returns:
- error message if validation fails, null if validation passes
-