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

    I'm using formit and I need to be create an XML file from the data inputted into the form and then attach it to the email.

    Has anyone done this before? Can anyone give me any advice or point me in the right direction?

    Thanks in advance.
      • 40706
      • 128 Posts
      Some Time ago i make something like that. It was just quite easy...
      You just have to assign an array to an Value with the PHP Upload-File Keys

      // Generate your XML
      // Save it
      $yourFilename = MODX_CORE_PATH.'cache/my.xml';
      
      $data['error'] = UPLOAD_ERR_OK;
      $data['name'] = basename($yourFilename);
      $data['tmp_name'] = $newTmpName;
      
      $hook->setValue('upload', $data);
      
        • 38359
        • 93 Posts
        Thanks for that, I've done a similar thing in the past generating pdfs and then emailing them with PHPmailer, so I think I know how attach the temporary file and send the email, but I don't know how to create the temporary XML file in the first place! Any ideas?