function wp_unique_filename( $dir,
$filename,
$unique_filename_callback = null
) { // Sanitize the file name before we begin processing.
$filename =
sanitize_file_name( $filename );
$ext2 = null;
// Initialize vars used in the wp_unique_filename filter.
$number = '';
$alt_filenames = array
();
// Separate the filename into a name and extension.
$ext =
pathinfo( $filename, PATHINFO_EXTENSION
);
$name =
pathinfo( $filename, PATHINFO_BASENAME
);
if ( $ext ) {