Hi, this plugin supports renaming uploaded files as you desired.
How do I rename uploaded files
Uploaded files can be automatically renamed using the ‘itsg_gf_ajaxupload_filename’ filter.
The example below shows how to use the filter to rename uploaded files to FileOfField{field_id}.originalExtension. For example WordDocument.doc would be renamed to FileOfField1.doc
add_filter( 'itsg_gf_ajaxupload_filename', 'my_itsg_gf_ajaxupload_filename', 10, 7 );
function my_itsg_gf_ajaxupload_filename( $name, $file_path, $size, $type, $error, $index, $content_range ) {
$field_id = isset( $_POST['field_id'] ) ? $_POST['field_id'] : null; // get the field_id out of the post
$file_extension = pathinfo( $name, PATHINFO_EXTENSION ); // get the file type out of the URL
$name = 'FileOfField' . $field_id . '.' . $file_extension; // put it together
return $name; // now return the new name
}
Additionally you can check plugins FAQ tab here in ww.wp.xz.cn site for more
Thread Starter
tberin
(@tberin)
Hi, thanks i’ve see the documentation thank you for pointing this out.
I was hoping for a single line text field on the backend to simply rename the file with a mask as it may become a very busy customization with more than 100 forms each with 30-40 files each.