Opened 19 years ago
Closed 18 years ago
#1739 closed defect (bug) (wontfix)
Added filters to image upload script
Reported by: | donncha | Owned by: | matt |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 1.6 |
Component: | General | Keywords: | dev-feedback |
Focuses: | Cc: |
Description
This patch adds two filters to the file wp-admin/image-uploading.php
- Check for upload errors before upload - useful to check for file space for example.
- Check file after uploading.
Functions for both filters should return true/message if an error so that first plugin integrates into current code logic, and functions can be shared.
98a99,101 > if( isset( $error ) == false ) > $error = apply_filters( "check_uploaded_file", $error ); > 427c430,434 < <?php elseif ( $action = 'upload' ) : ?> --- > <?php elseif ( $action = 'upload' ) : > if( apply_filters( "pre_upload_error", false ) == true ) { > ?><div class="center tip">Sorry, you have used your space allocation. Please delete some files to upload more files.</div><?php > } else { > ?> 440a448 > <?php } ?>
Change History (4)
Note: See
TracTickets for help on using
tickets.
Someone might develop a pre_upload_error filter for something other than checking for space. Shouldn't the text of the tip be the return value of the flunked filter? Subsequent filters should simply return any non-false initial value: