WordPress altere permalink no upload

add_filter('wp_handle_upload_prefilter', 'custom_upload_filter' );
function custom_upload_filter( $file ){
	$unique = rand(0,100);
	$finalstr = str_replace('.', "-".$unique.".", $file['name']);
   	$file['name'] = $finalstr;
    return $file;
}
Courageous Cardinal