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

    Is there a way to reference an attachment inside a ’eformOnBeforeMailSent’ function? I want to save a copy of the attachment on the server.

    Thanks in advance wink

    AndyFlan
      Hmmmmm.

      It's all a delusion
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      It looks like the $_FILES array is still around, you can check and see if you can access it through that. There is also the $attachments array; I don’t know if that becomes part of the $fields array (which is passed to the event function you create) or not.
        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
        • 1634
        • 51 Posts
        Thank you sottwell,

        $_FILES did the trick, brilliant wink
          Hmmmmm.

          It's all a delusion
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Question here is, is it still available to send as an attachment if it’s already been saved? As far as I understand, as soon as you move the temp_name to a permanent location the temp file is deleted.
            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
            • 1634
            • 51 Posts
            its working for me. I’m working out where the file is then using php copy() function
              Hmmmmm.

              It's all a delusion