Difference between revisions of "JFile::makeSafe"

From Joomla! Documentation

m (User contributed notes: added example)
m (See also: moving preparation)
(2 intermediate revisions by the same user not shown)
Line 29: Line 29:
===See also===
===See also===
* {{JVer|11.1}} '''JFile::makeSafe source code''' on [[jplatform:filesystem/file.php#cl-52|BitBucket]]
* {{JVer|11.1}} '''JFile::makeSafe source code''' on [[jplatform:filesystem/file.php#cl-52|BitBucket]]
* {{JVer|11.1}} Class [[JFile/11.1|JFile]]
* {{JVer|11.1}} Class [[API17:JFile|JFile]]
* {{JVer|11.1}} Subpackage [[Subpackage_Filesystem/11.1|Filesystem]]
* {{JVer|11.1}} Subpackage [[API17:Subpackage_Filesystem|Filesystem]]
* [[JFile::makeSafe|Other versions of JFile::makeSafe]]
* [[API17:JFile::makeSafe|Other versions of JFile::makeSafe]]
<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
Line 60: Line 60:
format= ,,,
format= ,,,
<noinclude>[[Category:Platform 11.1]][[Category:Archived pages API17]]</noinclude>

Latest revision as of 19:40, 11 May 2013

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Joomla 11.1 JFile::makeSafe


Makes file name safe to use.

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 Joomla 11.1

See also

SeeAlso:JFile::makeSafe [Edit See Also]

User contributed notes


		//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
		//Clean up filename to get rid of strange characters like spaces etc
		$filename = JFile::makeSafe($file['name']);

<CodeExamplesForm />