Gravity Wiz

Magically enhanced tutorials, snippets and plugins for Gravity Forms!

  • Gravity Perks
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    • Documentation
    • Support
    • Account

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

Last updated August 22, 2019 | Written by Jordan Smith 27 Comments

This article requires the Gravity Forms Media Library perk. Buy Gravity Perks today to get this perk plus 32 other galatic Gravity Forms plugins!

  • View the 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.

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.

gp-media-library-add-custom-field

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.

gp-media-library-set-file-upload

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.

gp-media-library-map-acf-field

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.

upload-to-media-library-setting-gravity-forms

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!

Did this resource help you do something awesome with Gravity Forms? Then you'll absolutely love Gravity Perks; a suite of 31+ essential add-ons for Gravity Forms with support you can count on.

  • View All Perks
  • Buy Gravity Perks

Filed Under: How To, Tutorials Advanced Custom Fields custom field file upload field GP Media Library

Comments

  1. Christopher Collett says

    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
    • David Smith says

      December 4, 2019 at 8:19 am

      Hi Christopher, if you haven’t already, drop us a line via support. We’ll be happy to dig into this.

  2. Christian Schneider says

    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
    • David Smith says

      August 25, 2019 at 11:24 am

      Is your ACF field a Gallery field or a single Image/File field?

    • Christian Schneider says

      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 ?

  3. Asaf says

    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
  4. Leland Zaremba says

    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
    • David Smith says

      August 24, 2018 at 10:12 am

      Hi Leland, we don’t have a solution for this one.

    • Leland says

      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.

  5. ean says

    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
  6. Kristopher Hadlock says

    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
    • Kristopher Hadlock says

      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?

    • David Smith says

      April 2, 2018 at 9:11 am

      Hey Kristopher, we’ll be happy to help via support. ?

  7. Olivier says

    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
  8. Samuel Young says

    May 27, 2017 at 10:27 am

    Would this work for uploading an avatar to a user profile?

    Reply
    • David Smith says

      May 28, 2017 at 11:16 am

      Hi Samuel, it would not replace the default WordPress avatar; however, you could feasibly use ACF to power local avatars and then this snippet would allow users to upload them via Gravity Forms. Here’s a start: http://thestizmedia.com/acf-pro-simple-local-avatars/

  9. Adam C. says

    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
    • David Smith says

      May 19, 2017 at 7:44 am

      Are you using Gravity Forms Media Library? If so, we’ll be happy to help you via support.

  10. Pieter says

    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
    • David Smith says

      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.

  11. Eduardo says

    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
    • David Smith says

      April 4, 2017 at 12:00 pm

      Hi Eduardo, check out the “Image Merge Tags” section here: https://gravitywiz.com/documentation/gravity-forms-media-library/ If you need a way to support merge tags on posts, see: https://gravitywiz.com/documentation/gravity-forms-post-content-merge-tags/

  12. K A says

    March 19, 2017 at 9:20 am

    Could we populate all the ACF fields via GF, any code snipped to do so?

    Reply
  13. Ladislav Šulc says

    February 7, 2017 at 6:55 pm

    Hello, any chance this would work with Pods? https://cs.wordpress.org/plugins/pods/

    Thank you.

    Reply
    • David Smith says

      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.

  14. Wilfrid says

    January 29, 2017 at 10:01 pm

    Hi, Thanks for this perks , But, when i use it with the gravityforms user update plugin i got this :

    Reply
    • David Smith says

      February 3, 2017 at 8:36 am

      Drop us a line via the support form and we’ll be happy to help!

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories

  • How To (34)
  • News (21)
  • Plugins (8)
  • Releases (7)
  • Resource (2)
  • Snippets (53)
  • Tutorials (42)
  • Updates (80)

Recent Posts

  • Complete Guide to Gravity Forms WooCommerce Integration
  • Gravity Wiz Weekly #80
  • Complete Guide to Gravity Forms Conditional Logic
  • Exporting with Nested Forms
  • Gravity Wiz Weekly #79

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Copyright © 2019 · Powered by WordPress · Gravity Wiz LLC · Log out

  • Support
  • Affiliates
  • About
  • Sitemap
  • Gravity Perks
    ▼
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    ▼
    • Documentation
    • Support
    • Account