Three highlights:
Add prefix/suffix to filenames.
Organize files into folders.
Works with gform_upload_path
filter!
add_filter( 'gform_upload_path', function ( $path_info, $form_id ) {
$path_info['path'] = WP_CONTENT_DIR . '/secret/path/';
$path_info['url'] = WP_CONTENT_URL . '/secret/path/';
return $path_info;
}, 10, 2 );
Works with File Upload Pro, Unique ID, and Media Library.
Three highlights:
Finally has a UI!
Support for incrementing filenames based on the order they were uploaded via the {i}
template merge tag.
Template:
{i}-{filename}
Results:
1-wizard.png
2-magic.png
3-wand.png
The gpfr_filename
gives magic powers!
Lowercase all filenames.
add_filter( 'gpfr_filename', function( $renamed_file, $file, $entry ) {
return strtolower( $renamed_file );
}, 10, 3 );
Apply a global filename template.
add_filter( 'gpfr_filename', function( $renamed_file, $file, $entry ) {
$renamed_file = gp_file_renamer()->rename_file( $file, '{entry:id}/{filename}-{i}', $entry );
return $renamed_file;
}, 10, 3 );