Hi. I know what you’re thinking! These plugins were not made by the same people, so they aren’t designed to work together. I understand that.
However, I’ve made a few websites in the past where setting up an image field that is populated from a gravity form is fairly simple and has made my life a lot easier.
After trying it again today on a new site, I’m finding that the Gravity Form does post the image to the field entry, but it does not sync up the file with the ACF in the admin post.
I’ve reached out to Gravity Forms, but its hard troubleshooting with them because technically GF isn’t doing anything wrong (the image shows up in the entry! just not the custom post with the ACFs).
I’m looking into other threads that say “GF sends a URL and not an attachment ID” or something like that. But this is ridiculous. Why can’t we get these two to work together? I can’t find any help or tutorials to get around this issue.
So am I correct in saying that the only direction to take this would be to create some kind of pre-processing function on gravity forms so it sends the right information to the ACF image field and populates?
Yes, all that is needed is to hook into the GF save, and modify the value before it is saved to the DB.
The quest is, ‘does GF insert the image data into the DB (like WP), or does it only save the file and provide a URL to see it’?
If GF does not save the DB data, then ACF can’t load the attachment. You could easily write some code which uses the url value to get a path to the image. Use this path to then insert the image into the db through some of WP’s built in image functions (google how to write a custom file uploader in WP)
Then, once you have the data inserted and an attachment ID, return this to GF for it to save, and then ACF will read it!
Hope that helps.
I am also trying to figure this out as I use ACF a lot and have many front end submission forms that I have to manually download image/audio/video and reupload to make work. Gravityforms uploads to its own folder by default but there is a plugin that allows images to be added to the Media Library: https://wordpress.org/plugins/gravity-forms-advanced-file-uploader/
What confuses me is that I can see under the URL of the image as the meta value listed with the correct meta key when viewing the custom fields section. However when I hit publish that custom field disappears from the backend and the image does not display on the front end. Can you give us any hints as to how we can make this work?
Hi there – has anyone come up with a solution to this? So far everything with Gravity Forms saving to my custom fields created with ACF work great… except for my custom image and gallery fields. I’d love to get this to work, but not sure where to look or who to ask.
Ok folks, the problem is Gravity Forms, not ACF. What you have to do is make the Gravity Form upload field point to a basic ACF TEXT field.
When you upload something through GF, it passes a URL to the location of the uploaded file. ACF needs more than a URL to recognize it as media. So unless GF releases an update where it returns an image object rather than a URL, this is the only work-around available when trying to use these plugins together.
The topic ‘Cant upload an image from a Gravity Form to an ACF image field’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2023 Advanced Custom Fields.