We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8425
    • 159 Posts
    Hi,
    I'm using FileUpload in MODx Revolution 2.x within a <form> as described below but nothing happens when I upload a file. I don't get any error message. If I put the FileUpload outside the <form> it works.
    What do I need to do to make it work within a form. I need to display a form in the front-end to let users update some fields. Any help is most than welcome as I'm stuck...
    Thanks for your time and help.

    <form action='[[~[[*id]]]]' method='POST' id='addAdForm'>
    .......
    [[!FileUpload? &filefields=`1``]]
    .................
    <input  type='submit' name='bannerBottomAdd' value='Add'
    </form>
    
    [ed. note: eclipseTalk last edited this post 14 years, 9 months ago.]
      • 32316
      • 387 Posts
      I think what is happening is that [[!FileUpload]] creates its own form thus you end up with a form within a form which is not valid html and the browser does not know what to do.

      As to what to do - you either need to redesign your page so that you can have two separate forms, or hack FileUpload, or write your own snippet that will work inside a form
        • 8425
        • 159 Posts
        Thanks for your reply. You're right I cannot use a form within a form. I've changed the FileUpload script and it works fine now