We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37079
    • 5 Posts
    I've seen a number of posts on this issue already and have tried all of the solutions offered without success.

    I have an eform to attach a file and send an email. The email is received but there is no attachment and the form report displays:

    Attachment: S

    (S is the first letter of the file name I tried to attach)

    I'm using Modx Evolution 1.0.4 with Eform 1.4.4.6.

    Here is the snippet call I'm using:

    [!eForm? &formid=`SubmitBrief` &subject=`Job Brief` &to=`[email protected]` &ccsender=`0` &tpl=`SubmitBrief` &report=`SubmitBriefReport` &gotoid=`46` !]


    Here is the form code:

    <form method="post" action="[~[*id*]~]" id="EmailForm" name="EmailForm">
    	
    <input name="formid" type="hidden" value="SubmitBrief" />
            
     <label for="cfName"><strong>Your Name</strong><br />
    <input style='width:250px;' name="name" id="cfName" class="text" type="text" eform="Your Name::1:" /> </label><br /><br />
    
    <label for="cfName"><strong>Company</strong><br />
    <input style='width:250px;' name="name" id="cfName" class="text" type="text" eform="Your Name::1:" /> </label><br /><br />
    
    <label for="cfEmail"><strong>Your Email Address</strong><br />
    <input style='width:250px;' name="email" id="cfEmail" class="text" type="text" eform="Email Address:email:1" /> </label><br /><br />
    
    <label for="cfTelephone"><strong>Your Telephone Number</strong><br />
    <input style='width:250px;' name="telephone" id="cfTelephone" class="text" type="text" eform="Telephone Number:telephone:1" /> </label><br /><br />
    
    <label for="attachment"><strong>Attach Your Job Spec</strong></label><br />       
    
    <input type="file" name="attachment" accept="text/plain,application/msword,application/rtf,application/pdf,text/html" eform="Attachment:file:0" /></p>
        
    <br /><input type="image" src="assets/templates/sustain/images/button-send-email.gif" name="contact" id="SubmitBrief" class="button" value="Send" alt="Send Email" title="Send Email" />
    </form>
    


    And the report code:
    
    <p>This email has been sent via the website by <b>[+email+]</b>.</p>
    <p><br />The details of the message are as follows:</p>
    
    <p><br /><b>Name:</b> [+name+]</p>
    <p><b>Email:</b> [+email+]</p>
    <p><b>Telephone:</b> [+telephone+]</p>
    <p><b>Attachment:</b> [+attachment+]</p> 
    
    <p><br />You can use this link to reply: <a href="mailto:[+email+]?subject=RE: [+subject+]">[+email+]</a></p>
    


    If anybody could help me out I'd be really grateful - I've already spent around 8 hours on this and have got nowhere!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      For a form to handle a file, you have to add the attribute
      enctype="multipart/form-data"

      to the form tag.

      <form method="post" action="[~[*id*]~]" id="EmailForm" name="EmailForm" enctype="multipart/form-data">
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 37079
        • 5 Posts
        Thanks sottwell. I could have sworn I'd tried it with that attribute before and it hadn't worked.

        Just added it now and it works.

        Must have overlooked it with fuzzy eyes from staring at code too long!

        Many thanks.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          It's usually the simple stuff that trips us up; we're expecting some kind of exotic bug, not the obvious.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org