• tsteinh

    (@tsteinh)


    I need to use this process per changes to Contact Form 7 5.4:

    add_action( ‘wpcf7_before_send_mail’, ‘my_dynamic_attachments’ );
    function my_dynamic_attachments( $cf7 ){
    $properties = $cf7->get_properties();
    $properties[‘mail’][‘attachments’] = SOME_FILE_PATH;
    $cf7->set_properties( $properties );
    }

    I need to know what SOME_FILE_PATH is relative to. I asked the original poster and was instructed to start a new topic. Is SOME_FILE_PATH a physical path on the server or is it relative to wp-content or another directory? I am creating the file to be attached in a subdirectory off of wp-content/uploads/. I’ve tried several different directory references and I can get the email but there is no attachment.

Viewing 4 replies - 1 through 4 (of 4 total)
  • ziegel

    (@ziegel)

    Thread Starter tsteinh

    (@tsteinh)

    Thank you @ziegel but that is where I got the code. I tried to ask my question in that thread and was told I needed to start a new topic. I have tried several ways to specify SOME_FILE_PATH and I cannot get the process to attach the file to the email. I get the email, but no attachment.

    ziegel

    (@ziegel)

    Hi @tsteinh,

    I manage to attach my own generated on the fly PDF. I wasn’t the one who wrote the code. So you should know, it does work, and it’s not a CF7 Version 5.4 problem.

    I thought some comments on that ticket made it clear it’s possible to attach uploaded by user files directly to the email. I’m not doing this, but integrate image or PDF within a newly generated PDF file which is attached.

    BTW – I don’t see “@tsteinh” on the above support ticket. Are tou sure it’s that one?

    https://wordpress.org/support/topic/how-to-access-add_uploaded_file-method/?#post-14148694

    Thread Starter tsteinh

    (@tsteinh)

    This is the ticket I originally tried to add my comment to:

    https://wordpress.org/support/topic/add_uploaded_file/

    I was told to open a new thread so I guess my request was removed. I am taking the contents of the form, adding some additional info, and creating a PDF on the fly. The pdf is stored in /wp-content/uploads/wpcf7_uploads/. Assume the name of the file is filename.pdf. I am unable to figure out what to use for SOME_FILE_PATH in the code snippet above. I’ve tried the complete physical path to the file, /wp-content/uploads/wpcf7_uploads/filename.pdf, simply filename.pdf, nothing works. I get the email but no attachment.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Upload File Issue’ is closed to new replies.