/** * Get the upload server * @return Upload_Server */ public function server($server = NULL) { if ($server !== NULL) { $this->_server = $server; return $this; } return Upload_Server::instance($this->_server); }
public static function server_local_fallback(array $params = array()) { $validation = Validation::factory($params)->rule('path', 'not_empty')->rule('fallback', 'not_empty')->rule('path', 'is_dir')->rule('url_type', 'in_array', array(':value', array(Flex\Storage\Server::URL_HTTP, Flex\Storage\Server::URL_SSL, Flex\Storage\Server::URL_STREAMING)))->rule('web', 'not_empty'); if (!$validation->check()) { throw new Kohana_Exception('Upload server local params had errors: :errors', array(':errors' => join(', ', $validation->errors('upload_server')))); } $server = new Flex\Storage\Server_Local_Fallback($validation['path'], $validation['web']); $server->fallback(Upload_Server::instance($validation['fallback'])); if (isset($validation['url_type'])) { $server->url_type($validation['url_type']); } return $server; }