What is the merge tag / recipe for showing uploaded files?

Hi!
I’ve been trying to show the file names of the upload on a summary at the end of a form before submit. But I can’t seem to find that information anywhere.
Does anybody know it?

Doing exactly what you described is not a feature of Gravity Forms, but you can try the following: https://docs.gravityforms.com/gform_review_page/

It sounds like you are trying to display a list of file names uploaded as part of a Gravity Forms submission. Here are a couple of ways you could approach this:

  1. Use the gform_pre_submission filter to modify the form data before submitting it. You can access the uploaded files through the $form array and then add a new field to the $form_data array to hold the file names.
  2. Use the gform_after_submission action to add the file names to the entry meta after submitting the form. You can then display the entry meta on the “Confirmation” page or in the notification emails.

Here is some example code for approach #1:

add_filter( 'gform_pre_submission', 'add_file_names_to_form_data' );

function add_file_names_to_form_data( $form_data ) {
  $file_names = array();
  foreach ( $form_data['fields'] as $field ) {
    if ( $field['type'] === 'fileupload' ) {
      $file_url = $field['value'];
      $file_name = basename( $file_url );
      $file_names[] = $file_name;
    }
  }
  $form_data['file_names'] = implode( ', ', $file_names );
  return $form_data;
}

This code will add a new field to the $form_data array called file_names, which will hold a comma-separated list of the uploaded file names. You can then access this field in the $form_data array when you display the form data on the “Confirmation” page or in the notification emails.

I hope this helps! Let me know if you have any questions.