BP_Attachment::validate_upload( array $file = array() )

Specific upload rules.

Description

Override this function from your child class to build your specific rules By default, if an original_max_filesize is provided, a check will be done on the file size.

See also

Parameters

$file

(Optional) The temporary file attributes (before it has been moved).

Default value: array()

Return

(array) The file.

Source

File: bp-core/classes/class-bp-attachment.php

	public function validate_upload( $file = array() ) {
		// Bail if already an error.
		if ( ! empty( $file['error'] ) ) {
			return $file;
		}

		if ( ! empty( $this->original_max_filesize ) && $file['size'] > $this->original_max_filesize ) {
			$file['error'] = 2;
		}

		// Return the file.
		return $file;
	}

Changelog

Changelog
Version Description
BuddyPress 2.3.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.