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