WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Contact Form 7] Possible to attach a file in my wp-content/uploads folder? (8 posts)

  1. benmath08
    Member
    Posted 5 years ago #

    Instead of attaching a file uploaded by the user, can I attach a file found in my wp-content/uploads folder?

    For example, when the user completes the form, I would like to send the normal email to me for notification, and then send a separate email to them with an "information packet" zip file attached. This file would be sent to all users who complete the form.

  2. benmath08
    Member
    Posted 5 years ago #

    With the new release of version 1.10, I can use some simple javascript to redirect the user to get the file. I put this in the "Additional Settings" window.

    on_sent_ok: "location.replace('http://myurl?getfile=#');"

    It works great! The form is submitted, email is sent, and the user is prompted with the download box for the file (they are even kept on the same form). However, it seems like this breaks the "Sender's message was sent successfully" confirmation box (it never appears).

    If I enter the form with missing required values, no download box appears (which is great!) and the "error" confirmation box appears as expected.

    This is not a huge issue for me, but I felt like I should bring it up since I'm not sure if the problem is with my code or a larger issue with the way the javascript action hook is handled.

  3. djones101
    Member
    Posted 5 years ago #

    Is it possible to use on_sent_ok to forward to another page? If so how could you achieve this?

    on_sent_ok: window.location = “http://www.yoursite.com/thankyou.html/”

    Does not work...

    Thanks,

    Dan

  4. benmath08
    Member
    Posted 5 years ago #

    on_sent_ok: "location.replace('http://www.google.com');"

    Should work. If you try to open a new window it will probably be blocked like a popup.

  5. kfrost1196
    Member
    Posted 5 years ago #

    I am using this:

    on_sent_ok: “location.replace('http://www.nightmareon13th.com/coupon.html’);”

    And it doesn't work. Can someone please help me! I'm desperate and I can't find a solution anywhere!

  6. elementel
    Member
    Posted 4 years ago #

    I can't get it either! This is killing me here. I've tried everything imaginable. Why is this working for some and not for others? Even just a simple location.replace, still not getting it to work.

  7. elementel
    Member
    Posted 4 years ago #

    to kfrost!

    you have to have

    <?php wp_footer(); ?>

    in the footer of your theme for this to work!!!

  8. harald
    Member
    Posted 4 years ago #

    elementel,

    Thanks for your update. I tried it, but after adding your line, the thankyou page does not load and I noticed the following error message on the page:

    Message: Invalid character
    Line: 95
    Character: 57
    Code: 0
    URI: http://www.mysite.com/wp-content/plugins/contact-form-7/contact-form-7.js?ver=2.0.2

    Any thoughts? I use Atahualpa.

Topic Closed

This topic has been closed to new replies.

About this Topic