WordPress.org

Ready to get started?Download WordPress

Forums

UploadPlus : File Name Cleaner
[resolved] [Plugin: Upload+] File name suffix (3 posts)

  1. difreo
    Member
    Posted 3 years ago #

    I added option "wordpress style" wich adds the suffix to the filename just like the wordpress uploader does it. If the filename is not unique, then a number will be added to the filename before the extension, and will continue adding numbers until the filename is unique. I think its better then the looong timestamps etc. I hope the author will check this out.

    In the plugins uploadplus.php
    added to the switch:

    $standard = get_option('uploadplus_prefix');
    switch($standard):
    //here goes the standard code
    //and below what i added
    case "B":
    $uploads = wp_upload_dir();
    $dir = ( $uploads['path'] );
    $filename = wp_unique_filename( $dir, $file_name, $unique_filename_callback = null );
    $file_name = $filename;
    break;

    and here:

    $otherstyles = array(
    	"7" => '[random (mt-rand)] '.mt_rand().$sep,
    	"8" => '[random md5(mt-rand)] '.md5(mt_rand()).$sep,
     	"9" => '[blog name] '.str_replace( array(".", " ", "-", "_") ,$sep,strtolower(get_bloginfo('name'))).$sep,
     	"A" => '[short blog name] '.str_replace( array(".","_","-"," "),"",strtolower(get_bloginfo('name'))).$sep,
    	"B" => 'wordpress style' // added this option
    	);

    http://wordpress.org/extend/plugins/uploadplus/

  2. Paolo T. (pixline)
    Member
    Plugin Author

    Posted 3 years ago #

    Thank you! I'm going to test it and include in the next update (yes, I'm going to upgrade it!)

  3. Ovidiu
    Member
    Posted 3 years ago #

    hooray!
    Please keep us updated!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic