Table of Contents

makeSafe

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage FileSystem Class JFile Method makeSafe Reference makeSafe() Never Work in Progress

Makes file name safe to use. This function filters out unsafe character sequences from the given file name. The regular expression used is: #\.\.[^A-Za-z0-9\.\_\- ]#. This will take out the combination of two dots (..) followed by anything that is not a letter, a number, a dot (.), an underscore (_), a hyphen (-) or a space ( ).

Syntax

string makeSafe ( $file )

$file string is a string containing the name of the file [not full path].

Examples

Example: This example gets the extension of a file.

Example

echo JFile::makeSafe( '..%clock.jpg' );

which will produce:

Result

clock.jpg