How to Upload Files & Images from Gravity Forms to Advanced Custom Fields

This article requires the Gravity Forms Media Library perk.

Buy Gravity Perks to get this perk plus 47 other premium Gravity Forms plugins!

View Plugin Buy Gravity Perks

GP Media Library enhances Gravity Forms to allow automatically importing files and images to the WordPress Media Library when you submit the form.

In this tutorial, we will show you how to use GP Media Library to map a submitted file or image to an Advanced Custom Fields (ACF) custom field.

Looking to upload files to Advanced Custom Fields with the Gravity Forms Advanced Post Creation Add-On? We have an article that walks you through it.

Steps

  1. Add an Image or File custom field via ACF
  2. Add a GF Custom Field to your form
  3. Set GF Custom Field field type to “File Upload”
  4. Map ACF Field to GF Custom Field
  5. Activate GP Media Library for the GF Custom Field

1. Add an Image or File custom field via ACF

The first thing we will do is visit the ACF Field Groups page and add an Image or File custom field.

gp-media-library-add-acf-field

2. Add a GF Custom Field to your form

Next, we will visit our Gravity Form and add a Custom Field to our form from the Post Fields section.

3. Set GF Custom Field field type to “File Upload”

Now let’s open the Custom Field field, locate the Field Type setting, select “File Upload” from the drop down.

GF File Upload Pro

Enhance File Upload fields with image previews, cropping, and more using Gravity Forms File Upload Pro.

4. Map GF Custom Field to ACF Custom Field

Locate the Custom Field Name setting. If you’ve just created the ACF field (like we did in this tutorial), select “New” and enter the name of your ACF field.

If you’re using an existing ACF field, selected “Existing” and select the field name from the drop down that appears.

5. Activate GP Media Library for the GF Custom Field

Lastly, select the “Perks” tab at the top of the field and select the “Upload to Media Library” option.

All set! Now, when the form is submitted, the file/image uploaded in this field will automatically be imported into the Media Library and mapped to the ACF custom field.

Working with ACF Gallery fields?
Good news! This plugin also supports mapping Gravity Forms Multi-file Upload fields to ACF Gallery fields.

We hope this helps!

Did this help you out? Let us know in the comments below!

Comments

  1. Hooman
    Hooman January 30, 2024 at 6:04 pm

    I’m trying to set this up for a client who’s purchased it. But I couldn’t find a way to integrated multiple file upload with ACF image or gallery properly. Is there any documentation beyond this? First, I was expecting this to work way better out of the box. I found some hacks, following the code from the developer who was previously working on the project, to use gform_pre_render and gform_field_value_field_id to load previews. (I’m setting GFFormsModel::$uploaded_files in gform_pre_render to set the file URLs). The preview images are the same (the first image getting repeated). Looking at the code data-file-id is set to the right image but the actual preview is the same (first) image getting repeated.

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff January 31, 2024 at 4:16 am

      Hi Hooman,

      I have some follow-up questions to better understand the issue you’re having, so we’ll be assisting you via the support ticket you submitted.

      Best,

  2. Chris
    Chris September 28, 2023 at 4:06 pm

    I have a custom post type with an ACF repeater field for “document uploads”. I am using a gravity form to allow front-end post submission of the specific post type.

    In the gravity form I have a file upload field and enabled multiple files and am using Advanced Post Creation. Everything maps correctly, except the file upload field.

    Are there any solutions for mapping docs, pdfs, etc. to an ACF Repeater Field using the file upload field in Gravity Forms?

    Reply
    1. Scott Ryer
      Scott Ryer Staff September 29, 2023 at 4:14 pm

      Currently, we only have a solution for mapping a Multi-file Upload field to an ACF Gallery field. Repeater fields are not supported. If you’re a Gravity Perks Pro customer, drop us a line in support, and we can look into adding support for this via a snippet.

  3. Joost van der Burght
    Joost van der Burght June 23, 2023 at 8:48 am

    Does this work with custom fields assigned to a user profile? Can’t seem to get it to function.

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff July 20, 2022 at 7:02 am

      Hi Simon,

      This won’t work with custom fields in User Post, because this is using the Post fields. I’ve sent you a message via email with more information on how to do this.

      Best,

    1. Scott Ryer
      Scott Ryer Staff December 3, 2021 at 4:34 pm

      Hi Bradley,

      It does, yes. All of our Perks do. Since sent us a support request, we’re going to reply there so we can get the bottom of your issue.

  4. Theodore
    Theodore March 27, 2020 at 8:31 am

    Hi, I think this is just what i need, but i cant get it to work.

    Im trying to use this perk to upload an image to a custom user profile field (created by ACF).

    1. Created the Custom field (tried types: file and image)
    2. Added the custom field in GF, selected file upload and mapped to the Custom field i created.
    3. Created a feed of user registration addon to create a new user (trying both: mapping the field there too or not).

    Am i doing something wrong?

    Any help would be great.

    Reply
  5. Christopher Collett
    Christopher Collett December 2, 2019 at 6:59 am

    When I enable the media library perk and pair it with my ACF field, the top of the form throws an error:

    Notice: Undefined index: id in /wp-content/plugins/gp-media-library/class-gp-media-library.php on line 512

    Reply
  6. Christian Schneider
    Christian Schneider August 25, 2019 at 10:16 am

    Hey. When having a multiple file upload to a form on front end. Only one file is uploaded / displayed in frontend / backend.

    Do I need to put the ACF field in a repeater first perhaps ?

    Please advice.

    Reply
    1. Christian Schneider
      Christian Schneider August 25, 2019 at 2:50 pm

      In ACF it’s a file field. Single. And in my Gravity form, it’s a File Upload, and in that File Upload it works perfekt with a single file, pdf, image, whatever.. But when I change it in Gravity to “Allow multiple files”, it only uploads one of the files to the post.

      Am I doing it wrong? Or obviously I am, but what lol ?

  7. Asaf
    Asaf November 5, 2018 at 3:06 am

    Hi

    I’m using your tutorial, but for some reason, when I go to the user edit page, I can’t see the file attached to the custom field. For some reason it doesn’t save it, as other fields. BTW, I tried using custom field field type, and file upload field type. Both not saving the file, though it is saved to the media

    Reply
    1. Natalie
      Natalie October 12, 2021 at 6:48 am

      Appreciate this is a longshot but I’m having the same problem…Just wondered if you managed to resolve this?

    2. Samuel Bassah
      Samuel Bassah Staff October 12, 2021 at 7:32 am

      Hi Natalie,

      You can try setting the ACF field return value to URL and ensure the GP Media Library Perk is activated on the field. If this doesn’t work for you, you can get in touch with us via our support form so we dig into this further.

      Best,

  8. Leland Zaremba
    Leland Zaremba August 4, 2018 at 12:21 pm

    Is it possible to show the uploaded thumbnails directly below the upload field instead of image file name? Is this something we could achieve with an HTML field and the merge tags or do they not work until after post submission? Would this be JS?

    Reply
    1. Leland
      Leland August 24, 2018 at 10:31 am

      I’ve sorted it out with some expert help from Codeable. Thanks for providing a great resource to the community.

  9. ean
    ean July 15, 2018 at 11:19 am

    I guess this doesn’t work with image files within repeater field or gallery? I would need to have multiple images on the form.

    Reply
  10. Kristopher Hadlock
    Kristopher Hadlock April 1, 2018 at 6:00 am

    First off, thanks for your hard work on the Perks set of plugins, nice job. We are attempting to connect an Custom Field to an ACF file field and we’re not seeing any ACF fields appear in the Custom Field Name drop-down. Could we be missing a perks plugin?

    Reply
    1. Kristopher Hadlock
      Kristopher Hadlock April 1, 2018 at 6:13 am

      We determined that the issue had to do with the fact that the field was never used in a Post. The issue is it had been used for a User, so that part seems like a bug with the Gravity Forms plugin itself. However, once we were able to get it connected we also found that the image was not added to the Users associated ACF field. Does this not work with ACF fields that are associated with Users?

  11. Olivier
    Olivier January 15, 2018 at 12:48 am

    Hi David,

    I know you answer a similar question in a previous comment but I just want to be sure GP works for my case before I buy it.

    I’m using GF to create users and update their profiles. In my “Update your profile” form, I have a picture profile upload field (image) and I manage that field with ACF in the backend of WP (native WP users). In your tutorial, you said to create a Custom field in GF but because it’s a profile update form (and not a form to create a post), is it still a Custom field? Because with the User registration GF add-on, you have to map the fields in the settings and not with Custom field like we would do normally.

    I still think this should be included in the default User registration add-on. You can populate a user profile with custom user meta fields unless it’s a upload field…

    Thank you

    Reply
  12. Adam C.
    Adam C. May 18, 2017 at 1:09 pm

    Hi I have run into an issue when using this method under HTTPS on WP Engine. I’m getting a

    Warning: filesize(): stat failed

    …Error message. Works fine under HTTP. Any thoughts on this?

    Reply
  13. Pieter
    Pieter April 11, 2017 at 10:25 am

    Hi! First of all: I love the gravity perks. They really saved me loads of time. I am now trying to use this perk to upload an image to a custom user profile field. I can’t get this to work. I am using the gravityforms user update plugin as well. Hope you can point me in the right direction to get this working. Pieter

    Reply
    1. David Smith
      David Smith Staff April 11, 2017 at 12:10 pm

      Hi Pieter, we’ll reply to your support request. This will probably need a little custom code to fill the gap.

  14. Eduardo
    Eduardo April 4, 2017 at 7:31 am

    Hi,

    So is possible to show thumbnails in front-end with all images the user uploaded instead plain-text?

    It requires ACF or there’re another way to do this?

    Thanks in advance

    Reply
    1. David Smith
      David Smith Staff February 7, 2017 at 9:05 pm

      Hi Ladislav, possibly. It would probably require a small amount of customization. Drop me a line (david at gravitywiz dot com) and let me know how you’re using Pods currently and how this would fit in with that.

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.

Grab a bundle of free Gravity Forms plugins

Enter your email and receive our most popular free plugins and snippets, plus access to hundreds of others.

This field is for validation purposes and should be left unchanged.