PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Images are not attached to the post when submitted from front end form

  1. Andrew Munro

    I have a custom post type of listing and on the edit/publish screen I have 5 meta boxes that a user can add images to from the media library. Because the images are inserted from the post, they become attached to that post and I can then use a simple WordPress gallery on the front-end to display the images.

    The problem I'm facing lies with a post submission form on the front end. I would like the user to upload 5 images from a form which generates a new post with those 5 images attached. Currently I am using a post "custom field" and linking each custom field up to the relevant wordpress custom field. This works great and if I then edit the post in the backend, I can see the 5 images in each of the 5 metaboxes. For some reason though, the images are not attached to the post and therefore don't appear in the gallery on the front end. Nor do they appear in the media library for that user.

    I realise GF uploads the images into a gravity forms folder, and this is no problem, but how I can get the images attached to the post when they submit the form from the front end?

    I thought to use a "post image" field instead while building the form but then I can't map it to each of the 5 meta boxes. Any ideas? Sorry for the long-winded post..

    Posted 5 years ago on Wednesday June 8, 2011 | Permalink
  2. cbrady

    Thank you for posting AntidoteCreative. I am trying to do something similar.

    I have a form that creates an entry for a custom post type. My form includes "Title," "Body," several "Custom Field" items, and three "Image" fields from GF's "Post Fields" options. After submitting my form, I am able to see the entry pending review under my custom post type and in the GF section. When I look at my custom post type, I do not see any of my images. I do however see them in the GF section and in the media area.

    I am interested in knowing if I should take the approach presented by AntidoteCreative, somehow build on what I have done, or something else entirely.

    Thank you.

    Posted 5 years ago on Thursday June 9, 2011 | Permalink
  3. Only the Post Image field attaches the image to your post as a Media Library item. The Post Image field is the only field that interacts with the Media Library. The Custom Field does not, it only creates custom fields.

    The only way this would be possible would be by writing custom code using the available hooks and filters to customize the behavior.

    Posted 5 years ago on Thursday June 9, 2011 | Permalink
  4. Andrew Munro

    Hi Carl,

    I'm not so good with writing hooks and filters, so I think I'll just leave this bit out and let the user upload images from the admin. Thanks

    Posted 5 years ago on Saturday June 11, 2011 | Permalink


Support Tickets

Open A New Support Ticket
 Open A New Priority Support Ticket *

* Developer license holders only