We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38181 ☆ A M B ☆
    • 26 Posts
    Hi,

    I need a file upload capability from a CMP page. I have seen the post that indicates to use xtype: 'file' and that presents fine in the UI and gives me exactly what I want. I can't seem to find any PHP code to go into the processor file to handle the file upload and store to the server.

    Can any body provide a sample piece of php processor code or explain how to handle the xtype; 'file' processing.

    Thanks

    Tim
      • 37548
      • 6 Posts
      Tim,

      The xtype file is not existing, you should look to the modx-combo-browser xtype.

      see https://forums.modx.com/index.php?topic=66771.0

      Thomas
        veni vidi vici
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        There is actually a file input, though from what I recall you need to use the textfield xtype, and specify inputType: 'file'. You'll also need (again, this is from memory) fileUpload: true in the form definition.

        modx-combo-browser is real easy, but if all you need is a simple file upload it can be better to not use it.

        The file inputType just sends files like regular forms, ie in a $_FILES global variable.
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.