Use of upload file input for advanced post type

Hi for some reason, the images are not transferring over to my posts. I’m using a file upload field (multiple fields allowed) and mapping them to my slides, which is a repeater of slide (which is type image).

This is what its uploading (ignore placeholder URLs):

  ["slides"]=>
  array(1) {
    [0]=>
    string(252) "https://xxxxxxxxxxx.png , https://xxxxxxxxxxx.png"
  }

Any ideas on how I make it work? Thank you.

Bumping this :frowning:

Hi Noah,

My apologies but I was waiting on Gravity Forms 2.7.15 to drop as it included the fix for the apc_media merge tag.

You want to make use of the :return_type of ids for the apc_media merge tag when mapping it to your field for “slides”:

We show an example of how to map this field up for gallery fields for ACF in this documentation:

That will send a comma-separated list of Media Attachment ID’s to the ACF field. You may need to follow up that process with a serialization using gform_advancedpostcreation_post_after_creation, but ACF might recognize the comma-separated list of ID’s.

There’s an example on that filter page for checkboxes, but it would pretty much be the same example; you would ocus on matching the field id instead of the field-type of ‘checkbox’:

The important line is this part:

// Convert to array.
$values = explode( ', ', $checked );

That will separate commas with spaces and return as an array.

Thank you so much for the detailed response, I’ll give this a go.

1 Like

Hey so I’ve just tried to change it to {apc_media:38:return_type} and it still uploads it like:

  ["slides"]=>
  array(1) {
    [0]=>
    string(252) "https://dddddddddddddd.com"
  }

When I do {apc_media:38:id}, it uploads like:

  ["slides"]=>
  array(1) {
    [0]=>
    string(169) "https://dddddddddddddd.com/index.php?gf-download=2023%2F10%2dddddd.png&form-id=1&field-id=38&hash=999999999999999999999999"
  }

Both of which don’t have the assets uploaded into the media library so that is possibly why it’s not appearing in the post?

Reminder I’m using a file upload (not a custom type) with multi-file upload enabled.

Any assistance is appreciated.

You need to use {apc_media:38:ids} not :id or :return_type. The :return_type as noted in this documentation (https://docs.gravityforms.com/apc_media-merge-tag/#h-return-type) can be ids or urls.

You also have to make sure that you’ve mapped your File Upload Field to be copied to the Media Library; otherwise an ID won’t be generated, since that process creates the attachment post.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.