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

Specific upload rules.


Description 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 See also


Top ↑

Parameters Parameters

$file

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

Default value: array()


Top ↑

Return Return

(array) The file.


Top ↑

Source 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;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.