Gravity Forms + Custom Post Types
Attach arbitrary file type to post? (4 posts)

  1. Travis Northcutt
    Posted 4 years ago #

    Is it possible, using this plugin, to allow the form submitter to upload a file which will then be attached to the newly created post? I'm aware of the "Image" post field, but that only allows image files, whereas I want to accept e.g. .doc and .pdf files.

    I tried using the "File Upload" field under the advanced group, but this doesn't seem to attach the file to the newly created post in any way - it just connects it to the gravity forms "entry".

    Any suggestions?


  2. Travis Northcutt
    Posted 4 years ago #

    It appears I was mistaken - using the file upload field and providing a custom field name results in a postmeta entry for the post being created, with the url to the uploaded file as the value. I'd still be interested to hear if there's a way to get it to create an attachment, and actually attach the file to the relevant post, but that's not 100% necessary (for my use case).

  3. Travis Northcutt
    Posted 4 years ago #

    Sorry to revisit this, but it turns out not having the uploaded file exist as an attachment is quite limiting. Since only the URL to the file is stored, there's no clean way to for instance get the size of the file, since that requires knowing the full path to the file. This is provided by get_attached_file() for WordPress attachments, but isn't available to files uploaded in this manner, since they have no ID.

  4. Israel Curtis
    Posted 3 years ago #

    I'm looking for the exact same functionality. I found this support discussion

    but this is from before the 1.6 update, and mentions it *may* be considered for the 1.7 update.

    I've heard there are some file-handling hooks available in gravity forms?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Gravity Forms + Custom Post Types
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic