Opened 9 years ago
Last modified 3 years ago
#34064 new enhancement
Filter the file type error message
Reported by: | kraftbj | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Filesystem API | Keywords: | |
Focuses: | Cc: |
Description
When uploading a file type that is not permitted, the error Sorry, this file type is not permitted for security reasons.
is returned.
By adding a filter, a plugin/site admin can add a customized message.
An example use case: A plugin that allows a front-end post submission system that allow file add-ons. By filtering the response, the author/admin can give more detailed specifications including allowable file types, if desired.
Example function of the filter in psudocode:
add_filter( 'upload_filetype_error', 'bk_test_error' ); function bk_test_error() { $allowed = get_allowed_mime_types(); $message = "This type of file is not allowed! Please use one of the following: " . implode( ', ', array_keys( $allowed ) ); return $message; }
Attachments (1)
Change History (2)
This ticket was mentioned in Slack in #core-media by antpb. View the logs.
3 years ago
Note: See
TracTickets for help on using
tickets.
first pass at filter.