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.

Uploading files to current post, with gravity forms.

  1. Hello,

    Is there anyway I can use gravity forms to have clients upload files to current post?

    Thank you in advance

    Posted 11 years ago on Monday December 24, 2012 | Permalink
  2. You can do this. When you embed the Gravity Form in a page or post, you will have access to the post ID. You will need that to attach files to the post. You can use the gform_after_submission hook to update an existing post: http://www.gravityhelp.com/documentation/page/Gform_after_submission

    In the first example on this page http://www.gravityhelp.com/documentation/page/Gform_after_submission#Examples you can see how to update a post. On line 06 though, you will need to get_post for the post the form is embedded in, not the post which was just created.

    Then, you can use the WordPress function wp_insert_attachment:
    http://codex.wordpress.org/Function_Reference/wp_insert_attachment

    Let us know if you need more pointers.

    Posted 11 years ago on Monday December 24, 2012 | Permalink
  3. Thank you, and merry christmas!

    Posted 11 years ago on Monday December 24, 2012 | Permalink
  4. Thank you. Let us know if you need more help.

    Posted 11 years ago on Monday December 24, 2012 | Permalink