I’ve tried several hours to get this to work, but I’m now at the point where I don’t know what else to try.
I’ve created a few custom fields for posts. Among them an image upload field.
Then I’ve built a Gravity Form for contributors to submit blog posts on the front-end, including a featured image, and up to 3 additional images to be saved into the post’s custom field.
In the GF (I’m using the Advanced Post Creation), I’ve added the Post Image field, and checked the box “Set as featured image”.
Then I created the post creation feed and mapped all other fields, including the image uploads.
I also changed the user capabilities for contributors to be allowed to upload files.
When a contributor submits the form, all fields get mapped and saved in the new post, EXCEPT all image fields. Not even the post image field gets saved in the back-end. It also doesn’t appear in the media library.
OK, I thought maybe there’s still something wrong with the contributor user role capabilities. So I tried the same form, logged in as an administrator.
Same problem.
Neither the post image gets saved in Wordpress, nor the additional images (no error message though).
All of the images get successfully submitted by the form, to my email, and also to the form entries. But they don’t make it into the media library and therefore not into the created post.
Never mind, I think I’ve found out myself that I shouldn’t use a post creating feed when I already use the post fields within the GF editor.
Working on the fine tuning now.
Yes, there’s another issue.
The submission of the featured image works fine now.
BUT
I’m trying in this front-end form (GF) to allow the user to upload a few “additional images”.
I’ve created a Metabox field group for posts, and one of the fields is the “Image Advanced” (similar to ACF gallery) field.
In the GF form I’ve added a “Post Field”, used the type “File Upload”, and mapped the field to the Metabox field ID.
When submitting the form the additional images get submitted to GF, but they don’t appear in the post, and also not in the Media library.
Sounds like you’re trying to use a repeating type of field but as far as I know, the GF post create functionality only works with standard types of fields … it might work with 3 separate image fields or url fields but not with a repeater type of field where all 3 values have to be serialized into one database entry.
The other issue is that when GF uploads a photo from a form, it normally goes to an obscured name in a GF specific upload folder for security reasons – the person or bot that uploaded the photo can’t easily guess where it is and what it is called so that if the “image” file is really a malicious piece of code, they can’t easily try to execute it by accessing its likely URL. If these users are trusted and you are confident there won’t be malware in their files, you can map these to the media library in the post creation feed settings but then you still need some code to put the proper URL from the new locaiton in the media library into a separate custom field.
I had to do something similar when I was using a GF form to create custom posts for Give WP donation forms in a fundraising walk. When a walker / team registers I catch their form entry and move the file to the media library then set it as the thumbnail for the donation form with some custom code. The post creation add-on couldn’t do all of what I needed.