JFile::makeSafe: Difference between revisions
From Joomla! Documentation
m JoomlaWikiBot moved page JFile::makeSafe/11.1 to API17:JFile::makeSafe without leaving a redirect: Robot: Moved page |
m →Example: moving preparation |
||
| Line 60: | Line 60: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
<noinclude>[[Category: | <noinclude>[[Category:Platform 11.1]][[Category:Archived pages API17]]</noinclude> | ||
Revision as of 15:58, 11 May 2013
JFile::makeSafe
Description
Makes file name safe to use.
Template:Description:JFile::makeSafe [Edit Descripton]
public static function makeSafe ($file)
| Parameter | Type | Default | Description |
|---|---|---|---|
| $file | string | The name of the file [not full path] |
- Returns string The sanitised string
- Defined on line 60 of libraries/joomla/filesystem/file.php
- Since

See also
JFile::makeSafe source code on BitBucket
Class JFile
Subpackage Filesystem- Other versions of JFile::makeSafe
Template:SeeAlso:JFile::makeSafe [Edit See Also]
User contributed notes
Example
//Retrieve file details from uploaded file, sent from upload form
$file = JRequest::getVar('upload_file', null, 'files', 'array');
//Import filesystem libraries. Perhaps not necessary, but does not hurt
jimport('joomla.filesystem.file');
//Clean up filename to get rid of strange characters like spaces etc
$filename = JFile::makeSafe($file['name']);
<CodeExamplesForm />