Opened 20 years ago
Closed 19 years ago
#1739 closed defect (bug) (wontfix)
Added filters to image upload script
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| 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:
function my_pre_upload_filter( $value ) { if ( false !== $value ) return $value // Do tests and return a true message or false }