• PHP code for xtype: 'file'#

  • timothy.butterworth@virgin.net Reply #1, 3 months, 2 weeks ago

    Reply
    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


  • tommytob Reply #2, 2 months, 2 weeks ago

    Reply
    Tim,

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

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


  • Mark Hamstra - MODX Complete Team Reply #3, 2 months, 2 weeks ago

    Reply
    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.