Support » Plugin: Gravity Forms + Custom Post Types » [Plugin: Gravity Forms Custom Post Types] Attach arbitrary file type to post?

  • 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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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).

    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.

    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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Gravity Forms Custom Post Types] Attach arbitrary file type to post?’ is closed to new replies.