We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9912
    • 4 Posts
    Hi,

    I am working on my first Revolution site and have a question relating to the snippet FORMIT:
    Is it possible to send an attachment with a formular?

    I have seen that in the modphpmailer.class.php exists a function named attach(), but I don’t know how to call (hook?) this function ...


    Many thanks,
    Stefan
      • 16633
      • 116 Posts
      I am looking to do the same, upload an attached through formit. I have not found anything to help me yet.
        --
        Landon Poburan
        Web Designer and Developer

        http://www.categorycode.ca
        http://www.landonp.com
        • 28215
        • 4,149 Posts
        The email hook will automatically add in attachments if you specify a "name" on the input field.
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
          • 16633
          • 116 Posts
          Will it simply email the attachment or does it have the ability to upload it to a specified folder? I am looking to do both.
            --
            Landon Poburan
            Web Designer and Developer

            http://www.categorycode.ca
            http://www.landonp.com
            • 16633
            • 116 Posts
            Quote from: splittingred at Oct 26, 2010, 09:13 PM

            The email hook will automatically add in attachments if you specify a "name" on the input field.

            Hello, I have added a file to a form. It does not send as an attachment nor upload. What changes do I need to make?

            Here is the HTML

            <div class="row clearfix">
            <div class="label">Supplementary Files
            <span class="error">[[+fi.error.nomination_file]]</span></div> <!-- end of .label -->
            <div class="input"><input id="nomination_file" name="nomination_file" type="file" value="[[+fi.nomination_file]]" /></div> <!-- end of .input -->
            </div> <!-- end of .row -->

            I have a TV set up, so it does store the value of the filename.
              --
              Landon Poburan
              Web Designer and Developer

              http://www.categorycode.ca
              http://www.landonp.com
              • 16633
              • 116 Posts
              Hey @fnkst have you resolved this?

              Do you want to simply have the attachment send with the email?

              As he mentioned, if you have a file input with a name it does attach to the email.
                --
                Landon Poburan
                Web Designer and Developer

                http://www.categorycode.ca
                http://www.landonp.com
                • 29154
                • 1 Posts
                Hey,

                I’m having a problem with my attachments, they upload and attach fine, but when i receive them in an email the file name is a bunch of random letters and the file extension is missing.

                anyone have a clue where im going wrong?

                Thanks
                • I’m also having trouble getting attachements to work with FormIt - they upload on the form, but nothing is attached to the sent email.

                  My HTML code is as follows:

                      <fieldset>
                      <label for="attachments">  
                          Attachments <span class="error">[[+fi.error.attachments]]</span>  
                      </label>  
                      <input id="attachments" name="attachments" type="file" value="[[+fi.attachments]]" />  
                      </fieldset>  


                  And my snippet call is:

                      [[!FormIt? &hooks=`name,email,phone,attachments,spam,redirect,recaptcha` &emailUseFieldForSubject=`1` &emailTpl=`contact.form` &emailTo=`[email protected]` &redirectTo=`45` &validate=`name:required:testFormItValidator, email:email:required, phone:isNumber:required, subject:required, message:required:stripTags`]]


                  Do I need to include [[+attachments]] in the emailTpl chunk or anything? Any ideas?
                    MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
                    • 10474
                    • 6 Posts
                    Make sure you’ve included Set the Form enctype (enctype="multipart/form-data") in your form tag.

                    e.g.
                    <form id="contactForm" class="cmxform" method="post" action="[[~[[*id]]]]" enctype="multipart/form-data">

                    Then just include the file input into your form
                    e.g.
                    <label for="contact_attachment">Attach a File </label>
                    <input type="file" name="contact_attachment" value="[[!+fi.contact_attachment]]" />

                    Full instructions can be found at http://codingpad.maryspad.com/2011/03/09/modx-revolution-adding-an-attachment-field-to-a-formit-form/
                      • 8548
                      • 104 Posts
                      I have a probleme with the attachement file...

                      I’ve copied the exacte same thing has above in my modx file.

                      All I get is the name of the file, but not the file it’s self sad

                      the thing I see I mignt be mission is the attachments hook!
                      where is it, can’t seem to find in anywhere sad

                      help please, I really need this to work in revolution 2.1 and formit 1.6.

                      thanks