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.

File Upload Link

  1. monoxgas
    Member

    I am trying to use the attachments feature in the 1.7 beta, but I can't seem to get the notifications to send with the attachments, they just come through as normal E-Mails.. Here is the code from my functions.php:

    add_filter('gform_notification', 'change_admin_notification_attachments', 10, 3);
    function change_admin_notification_attachments( $notification, $form, $entry ) {
        if($notification["name"] == "Admin Notification"){
    
            $fileupload_fields = GFCommon::get_fields_by_type($form, array("fileupload"));
    
            if(!is_array($fileupload_fields))
                return $attachments;
    
            $attachments = array();
            $upload_root = RGFormsModel::get_upload_root();
            foreach($fileupload_fields as $field){
                $url = $lead[$field["id"]];
                $attachment = preg_replace('|^(.*?)/gravity_forms/|', $upload_root, $url);
                if($attachment){
                    $attachments[] = $attachment;
                }
            }
            $notification["attachments"] = $attachments;
        }
        return $notification;
    }

    Any help with this would be much appreciated, I would prefer the attachments instead of a link. Note, I use the WP-Mail-SMTP plugin.

    Thanks!

    Posted 11 years ago on Thursday March 21, 2013 | Permalink
  2. Are you uploading just one file or multiple files? There was a problem in beta 1 (which is fixed in beta 2) that prevented you from sending single path attachments (only arrays of attachments were supported.) Is that your issue?

    Posted 11 years ago on Sunday March 24, 2013 | Permalink
  3. monoxgas
    Member

    Sounds like that's the problem, I only have one File Upload in that form. Glad it was found and fixed in Beta 2, I will keep my ears open for when it is released.

    Posted 11 years ago on Monday March 25, 2013 | Permalink
  4. Thank you. It will be announced on our blog when it's released http://www.gravityhelp.com/

    Posted 11 years ago on Monday March 25, 2013 | Permalink
  5. 1.7 Beta 2 was released today which fixes this problem:
    http://www.gravityhelp.com/gravity-forms-v1-7-beta-2-released/

    Posted 11 years ago on Tuesday March 26, 2013 | Permalink

This topic has been resolved and has been closed to new replies.