Hey,
Can you share what filter you’ve applied so far?
The filename shouldnt be what you’ve shown (that is, the name shouldnt include the path).
I’m using this filter on my demo site and it’s not having the same issue.
https://demo.itsupportguides.com/ajax-upload-for-gravity-forms/multi-page-form/
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 ) {
$form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : null; // get the form_id out of the post
$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
$form_meta = GFFormsModel::get_form_meta( $form_id ); // load the form meta
$field = GFFormsModel::get_field( $form_meta, $field_id ); // get the field
$field_label = GFFormsModel::get_label( $field ); // get the field label
$field_label = preg_replace( '/[^A-Za-z0-9 ]/', '', $field_label ); // make sure the field label only includes supported characters -- restricting to A-Z 0-9
$name = $field_label . '_' . $field_id . '_' . $form_id . '.' . $file_extension; // put it together
return $name; // now return the new name
}
What were you wanting to change the file name to?
If using a username/user id – will a user always be logged in, what would you use if not logged in.