Make WordPress Core

Opened 19 years ago

Closed 18 years ago

#1739 closed defect (bug) (wontfix)

Added filters to image upload script

Reported by: donncha's profile donncha Owned by: matt's profile 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

  1. Check for upload errors before upload - useful to check for file space for example.
  1. 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)

#1 @skeltoac
19 years ago

  • Keywords bg|2nd-opinion bg|has-patch added

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
}

#2 @Nazgul
18 years ago

  • Keywords dev-feedbacl added; bg|2nd-opinion bg|has-patch removed

Is this one still valid with the recent upload changes?

#3 @Nazgul
18 years ago

  • Keywords dev-feedback added; dev-feedbacl removed

#4 @Nazgul
18 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

This ticket has been dead for two years.

If somebody has any opinions about this issue, they can reopen it or create a new one.

Note: See TracTickets for help on using tickets.