Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: pre_upload_error

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
1460                return $this->error;
1461
1462           set_current_user(0, $user_login);
1463           if ( !current_user_can('upload_files') ) {
1464                logIO('O', '(MW) User does not have upload_files capability');
1465                $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.'));
1466                return $this->error;
1467           }
1468
1469           if ( $upload_err = apply_filters( "pre_upload_error", false ) )
1470                return new IXR_Error(500, $upload_err);
1471
1472           $upload = wp_upload_bits($name, $type, $bits, $overwrite);
1473           if ( ! empty($upload['error']) ) {
1474                $errorString = 'Could not write file ' . $name . ' (' . $upload['error'] . ')';
1475                logIO('O', '(MW) ' . $errorString);
1476                return new IXR_Error(500, $errorString);
1477           }
1478           // Construct the attachment array