This is the API documentation for concrete5 version 5.6 and earlier. View Current API Documentation

Class Concrete5_Helper_File

Direct known subclasses


Package: Helpers
Copyright: Copyright (c) 2003-2008 Concrete5. (
License: MIT License
Author: Andrew Embler
Located at core/helpers/file.php

Methods summary

# getDirectoryContents( $dir, $ignoreFilesArray = array(), $recursive = false )
public string
# unfilename( string $filename )

Removes the extension of a filename, uncamelcases it.

# copyAll( string $source, string $target, integer $mode = NULL )

Recursively copies all items in the source directory or file to the target directory

# removeAll( string $source )

Removes all files from within a specified directory

# forceDownload( stings $file )

Takes a path to a file and sends it to the browser, streaming it, and closing the HTTP connection afterwards. Basically a force download method

public string
# getTemporaryDirectory( )

Returns the full path to the temporary directory

public {@link
# append( string $filename, string $content )

Adds content to a new line in a file. If a file is not there it will be created

public string
# getContents( string $file, string $timeout = 5 )

Just a consistency wrapper for file_get_contents Should use curl if it exists and fopen isn't allowed (thanks Remo)

public {@link
# clear( $file )

Removes contents of the file

public string
# sanitize( string $file )

Cleans up a filename and returns the cleaned up version

public string
# getExtension( string $filename )

Returns the extension for a file name

public string
# replaceExtension( string $filename, string $extension )

Takes a path and replaces the files extension in that path with the specified extension

public StdClass
# getCreateFilePermissions( string $path = NULL )

returns an object with two permissions modes (octal): one for files: $res->file and another for directories: $res->dir