sanitize_file_name


sanitize_file_name ( $filename )

Parameters:
  • (string) $filename The filename to be sanitized
Returns:
  • (string) The sanitized filename
Defined at:

Description

Sanitizes a filename, replacing whitespace with dashes.

Removes special characters that are illegal in filenames on certain operating systems and special characters requiring special escaping to manipulate at the command line. Replaces spaces and consecutive dashes with a single dash. Trims period, dash and underscore from beginning and end of filename. It is not guaranteed that this function will return a filename that is allowed to be uploaded.

Related Functions

sanitize_title, sanitize_meta, sanitize_term, sanitize_email, sanitize_title_with_dashes

Top Google Results

User discussions

wpseek mobile