WordPress.org

Ready to get started?Download WordPress

Ideas

Add a filter to wp_unique_filename

  1. coldwinds
    Member

    12345

    function wp_unique_filename( $dir, $filename, $unique_filename_callback = null )

    ======

    function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
    	if ( empty( $name ) )
    		return array( 'error' => __( 'Empty filename' ) );
    
    	$wp_filetype = wp_check_filetype( $name );
    	if ( !$wp_filetype['ext'] )
    		return array( 'error' => __( 'Invalid file type' ) );
    
    	$upload = wp_upload_dir( $time );
    
    	if ( $upload['error'] !== false )
    		return $upload;
    
    ***=>	$filename = wp_unique_filename( $upload['path'], $name );

    There is no way to use custom wp_unique_filename generator @ function wp_upload_bits

    Posted: 4 years ago #
  2. John James Jacoby
    BuddyPress/bbPress Lead

    http://core.trac.wordpress.org

    Add a ticket and file it as an enhancement request.

    Posted: 4 years ago #
  3. Jen Mylo
    Key Master

    @coldwinds: You were right to ost this in Ideas rather than on Trac, as ideas for core are meant to be discussed here and added to Trac only when it's been decided that they belong there. However, you should include an intro to the code to describe what you are proposing and why, to make it easier to scan the forum threads.

    @John James Jacoby: The only time someone should go to Trac to propose a change rather than the Ideas forum is if it is a bug ticket. All enhancements and feature requests are meant to be discussed here first, and moved to Trac when it's been determined by the core team that they should be implemented.

    Posted: 4 years ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    8 Votes
  • Status

    This idea is under consideration

Tags