sanitize_file_name
sanitize_file_name ( $filename )
Parameters:- (string) filename The filename to be sanitized.
Returns:- (string) The sanitized filename.
Defined at: - Introduced in WordPress: 2.1.0
- Deprecated in WordPress: —
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.