Package formflow.library.file
Class FileValidationService
java.lang.Object
formflow.library.file.FileValidationService
This service is intended to help with miscellaneous file things. This service will help with checking mime types, both proper
mime-type names like "image/jpeg" and with file extensions. The current list of accepted file mime-types are:
- .bmp : image/bmp
- .doc : application/msword"
- .docx : application/vnd.openxmlformats-officedocument.wordprocessingml.document
- .gif : image/gif
- .jpeg : image/jpeg
- .jpg : image/jpeg
- .pdf : application/pdf
- .png : image/png
- .odp : application/vnd.oasis.opendocument.presentation
- .ods : application/vnd.oasis.opendocument.spreadsheet
- .odt : application/vnd.oasis.opendocument.text
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionProvides the list of acceptable file types the system accepts in a string form, like so: ".bmp,.jpg"Returns the list of file extensions the system accepts: ".bmp, .doc"isAcceptedMimeType(org.springframework.web.multipart.MultipartFile file) Returns True if the file is of the appropriate mime type for the system setup.booleanisTooLarge(org.springframework.web.multipart.MultipartFile file)
-
Field Details
-
MB_IN_BYTES
public static final long MB_IN_BYTES- See Also:
-
-
Constructor Details
-
FileValidationService
-
-
Method Details
-
getAcceptableFileExts
Returns the list of file extensions the system accepts: ".bmp, .doc"- Returns:
- List of strings containing the acceptable file extensions for the system
-
isAcceptedMimeType
Returns True if the file is of the appropriate mime type for the system setup. This takes into account the configuration set in the application's configuration.- Parameters:
file- the file to check the mime type of- Returns:
- Boolean True if the mimetype is one of the ones the system accepts, False otherwise.
-
acceptedFileTypes
Provides the list of acceptable file types the system accepts in a string form, like so: ".bmp,.jpg"- Returns:
- String a string containing a list of acceptable file extensions: ".bmp,.jpg"
-
isTooLarge
public boolean isTooLarge(org.springframework.web.multipart.MultipartFile file) -
getMaxFileSizeInMb
-