public function set_restrictions(array $restrictions) {
		$this->restrictions = array();

		foreach ($restrictions as $k => $v) {
			switch ($k) {
				case 'maxsize':
					if (is_int($v)) {
						$this->restrictions['maxsize'] = $v;
					}
					break;

				case 'mediatype':
					if (is_array($v)) {
						$this->restrictions['mediatype'] = $v;
					}
					break;

				case 'mimetype':
					if (is_array($v)) {
						$this->restrictions['mimetype'] = $v;
					}
					break;

				case 'extension':
					if (is_array($v)) {
						$this->restrictions['extension'] = $v;
					}
					break;
			}
		}
		return true;
	}
public function set_restrictions(array $restrictions) {
		$this->restrictions = array();

		foreach ($restrictions as $k => $v) {
			switch ($k) {
				case 'maxsize':
					if (is_int($v)) {
						$this->restrictions['maxsize'] = $v;
					}
					break;

				case 'mediatype':
					if (is_array($v)) {
						$this->restrictions['mediatype'] = $v;
					}
					break;

				case 'mimetype':
					if (is_array($v)) {
						$this->restrictions['mimetype'] = $v;
					}
					break;

				case 'extension':
					if (is_array($v)) {
						$this->restrictions['extension'] = $v;
					}
					break;
			}
		}
		return true;
	}
public function set_restrictions ( array $ restrictions ) { $ this -> restrictions = array ( ) ; foreach ( $ restrictions as $ k => $ v ) { switch ( $ k ) { case 'maxsize' : if ( is_int ( $ v ) ) { $ this -> restrictions [ 'maxsize' ] = $ v ; } break ; case 'mediatype' : if ( is_array ( $ v ) ) { $ this -> restrictions [ 'mediatype' ] = $ v ; } break ; case 'mimetype' : if ( is_array ( $ v ) ) { $ this -> restrictions [ 'mimetype' ] = $ v ; } break ; case 'extension' : if ( is_array ( $ v ) ) { $ this -> restrictions [ 'extension' ] = $ v ; } break ; } } return true ; }
Set restrictions on file uploads.
@param array $restrictions An array of restrictions. Possible keys are:
maxsize (int) A maximum size (in bytes) for the uploaded file.
mediatype (array) An array of allowed mediatypes.
mimetype (array) An array of allowed mimetypes.
extension (array) An array of allowed file extensions.
Set restrictions on file uploads .