@param $file_name

@return string
@throws \yii\base\Exception
978022
public static function getFileNameSave($file_name)
    {
        FileHelper::createDirectory(self::getUploadDir() . '/' . date('Y/m/d'));
        return self::getUploadDir() . '/' . $file_name;
    }
22154
public function getFileName($source_name, $type, $tmp_name, $index, $content_range, FileUpload $upload)
    {
        $this->filesystem = $upload->getFileSystem();
        $this->pathresolver = $upload->getPathResolver();

        $source_name = $this->getSluggedFileName($source_name);
        $uniqueFileName = $this->getUniqueFilename($source_name, $type, $index, $content_range);

        return $this->getSluggedFileName($uniqueFileName);
    }
1178541
public function loadFile($file_name, $dir_name = null)
    {
        try {
            $loader = $this->getLoader();
            $file_path = $loader->findLanguageDBFile(
                !empty($file_name) ? basename($file_name) : $file_name,
                !empty($dir_name) ? $dir_name : (
                    !empty($file_name) ? dirname($file_name) : $dir_name
                )
            );
            if ($file_path && file_exists($file_path)) {
                $loader
                    ->setOption('language_strings_db_directory', dirname($file_path))
                    ->setOption('language_strings_db_filename', basename($file_path))
                ;

                $this->_loadLanguageStrings(true, true, true);
            } else {
                throw new I18nInvalidArgumentException(
                    sprintf('Language file "%s" not found!', $file_name)
                );
            }
        } catch (I18nException $e) {
            throw $e;
        }
    }
365249
public function preview($file_name)
	{
		if (!\Entrust::can('preview-logs')) {
	        abort(403, 'Unauthorized access - you do not have the necessary permission to preview logs.');
	    }

		$disk = Storage::disk('local');

		if ($disk->exists('logs/'.$file_name)) {
			$this->data['log'] = [
									'file_path' => 'logs/'.$file_name,
									'file_name' => $file_name,
									'file_size' => $disk->size('logs/'.$file_name),
									'last_modified' => $disk->lastModified('logs/'.$file_name),
									'content' => $disk->get('logs/'.$file_name),
									];

			return view("logmanager::log_item", $this->data);
		}
		else
		{
			abort(404, "The log file doesn't exist.");
		}
	}
683424
public function clearLogFile($file_name)
    {
        $file = $this->log_path . $file_name;
        
        if ((!file_exists($file) && is_writable($this->log_path)) || is_writable($file)) {
            return @unlink($file);
        }
        
        return false;
    }
484105
private function get_file_extension( $view_root, $template_name ) {
		$paths = to_array( $this->get_path_to_views() );
		// get first element in array
		$path = reset( $paths );

		if ( ! empty( $view_root ) ) {
			$path .= '/' . $view_root;
		}

		$path .= '/' . $template_name;

		$files = glob( $path . '.*' );
		//return pathinfo of first $files element
		return pathinfo( reset( $files ), PATHINFO_EXTENSION );
	}
582052
private static function load($class_name)
    {
        $class_name = trim($class_name, '\\');

        foreach (self::$_namespace_list as $namespace => $path_list) {
            $pattern = '/^' . str_replace('\\', '\\\\', $namespace) . '/';

            if (!preg_match($pattern, $class_name)) {
                continue;
            }

            $class_name = str_replace($namespace, '', trim($class_name, '\\'));
            $class_name = str_replace('\\', '/', trim($class_name, '\\'));

            foreach ($path_list as $path) {
                if (!file_exists("{$path}/{$class_name}.php")) {
                    continue;
                }

                require "{$path}/{$class_name}.php";

                return true;
            }
        }

        throw new Exception("Class: {$class_name} is not found.");
    }
78639
private function getFilePath()
    {
        $fullname = $this->fullName;
        $rootPath = Yii::getAlias('@webroot');

        if (substr($fullname, 0, 1) != '/') {
            $fullname = '/' . $fullname;
        }

        return $rootPath . $fullname;
    }
656146
protected function findViewFile(string $name): string {
    if (!mb_strlen($name)) throw new InvalidArgumentException('The view name is empty.');

    $controller = \Yii::$app->controller;
    if (mb_substr($name, 0, 2) == '//')
      $file = \Yii::$app->viewPath.DIRECTORY_SEPARATOR.ltrim($name, '/');
    else if ($name[0] == '/') {
      if (!$controller) throw new InvalidCallException("Unable to locate the view '$name': no active controller.");
      $file = $controller->module->viewPath.DIRECTORY_SEPARATOR.ltrim($name, '/');
    }
    else {
      $viewPath = $controller ? $controller->viewPath : \Yii::$app->viewPath;
      $file = \Yii::getAlias("$viewPath/$name");
    }

    $view = \Yii::$app->view;
    if ($view && $view->theme) $file = $view->theme->applyTo($file);
    if (!mb_strlen(pathinfo($file, PATHINFO_EXTENSION))) $file .= '.'.($view ? $view->defaultExtension : 'mustache');
    return $file;
  }
124640
protected function getCurlValue($file_string, $name = null)
	{
		if ( $name === null ) {
			$name = basename($file_string);
		}

		if ( !function_exists('curl_file_create') ) {
			return $file_string . ';filename=' . $name;
		}

		return curl_file_create(substr($file_string, 1), '', $name);
	}
819640
public static function get_encoded_delimiter($delimiter_name) {
        global $CFG;
        if ($delimiter_name == 'cfg' and isset($CFG->CSV_ENCODE)) {
            return $CFG->CSV_ENCODE;
        }
        $delimiter = csv_import_reader::get_delimiter($delimiter_name);
        return '&#'.ord($delimiter);
    }
459372
public static function displayFilename (FtpFile $file, FtpWidget $context) {
		if ($context->allowNavigation && self::isDir($file)) {
			$dir = $context->baseFolder."/".$file->filename;
			if ($context->baseFolder == "/") {
				$dir = "/".$file->filename;
			}
			if ($file->filename == '..') {
				$dir = str_replace('\\', '/', dirname($context->baseFolder));
			}
			$arr = array_merge([""], $_GET, [$context->navKey => $dir]);
			return \yii\helpers\Html::a($file->filename, $arr);
		} else {
			return $file->filename;
		}
	}
272970
public function getFilename(string $name): ?string
    {
        if (!empty($file = $this->get($name)) && !$file->getError()) {
            return StreamWrapper::getFilename($file->getStream());
        }

        return null;
    }
686133
static function GetFileContent($filename,&$error = null,&$error_str = null){
		$error = false;
		$error_str = "";

		$out = "";
		
		settype($filename,"string");

		if(!is_file($filename)){
			$error = true;
			$error_str = "$filename is not a file";
			return null;		
		}

		$filesize = filesize($filename);
		if($filesize==0){ return ""; }

		$f = fopen($filename,"r");
		if(!$f){
			$error = false;
			$error_str = "can't open file $filename for writing";
			return $out;
		}
		$out = fread($f,$filesize);
		fclose($f);

		return $out;
	}
1052540
private function getFilename($name)
    {
        if (file_exists($name)) {
            return $name;
        }

        [$plugin, $file] = pluginSplit($name);
        foreach ([null, $plugin] as $scope) {
            $paths = $this->getPaths($scope);
            foreach ($paths as $path) {
                $filePath = $path . $file;
                if (is_file($filePath)) {
                    return $filePath;
                }

                $filePath = $path . $file . TwigView::EXT;
                if (is_file($filePath)) {
                    return $filePath;
                }
            }
        }

        return false;
    }
798573
public function getAttributeTypeFileURL($_file)
    {
        $env = \Environment::get();
        $r = $env->getRecord(
            implode('/', [DIRNAME_ATTRIBUTES . '/' . $this->attributeType->getAttributeTypeHandle() . '/' . $_file]),
            $this->attributeType->getPackageHandle()
        );
        if ($r->exists()) {
            return $r->url;
        }
    }
531237
public function getFilename()
    {
        if ($this->isDirty && $this->filename) {
            return $this->filename;
        }

        if ($this->riakGridFSFile instanceof \RiakGridFSFile && $filename = $this->riakGridFSFile->getFilename()) {
            return $filename;
        }

        return $this->filename;
    }