/** * NUpload::connect - Connect NUpload to the specified upload handler * @param string $handler the class name of the upload handler * @return null */ public static function connect($handler) { if (getenv('UPLOAD_PREFIX')) { self::$prefix = getenv('UPLOAD_PREFIX'); } if (!class_exists($handler)) { throw new Exception("Upload handler class doesn't exist", 1); } $handler = new $handler(); if (!$handler instanceof NUpload) { throw new Exception("Upload handler is not instance of NUpload: {$handler}", 1); } self::$handler = $handler; if (method_exists($handler, 'init')) { call_user_func(array(self::$handler, "init"), null); } }