| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
FileSystem |
JFile |
makeSafe |
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 ( ).
string makeSafe ( $file )
| $file | string | is a string containing the name of the file [not full path]. |
Example: This example gets the extension of a file.
Example
echo JFile::makeSafe( '..%clock.jpg' );
which will produce:
Result
clock.jpg