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

    I have a form using FormIt to build, its working good.

    Now I had to add an file upload field in my form.

    So I decided use AjaxUpload plugin ( https://rtfm.modx.com/extras/revo/ajaxupload )

    I'm having problem saving the uploaded files
    I'd follow the documentation usage and set

    &ajaxuploadTarget=`media/documents/uploads/`

    When user upload same file name example 'abc.pdf' then the files will auto delete and dissapear.

    How can I set the upload file name to unique name and store the name with my FormitSaveForm hooks?

    I'd look into ajaxupload.class.php to modify $originalName at line 244, seems the filename didn't change...

    May I know what a right-way to upload files using modx's formit plugin?

    Thank you all, appreciate the helps.
      • 13428 ☆ A M B ☆
      • 1,031 Posts
      AjaxUpload does not create unique filenames in the target folder. That has to be done by another hook (and prehook). You could set i.e. a dynamic target folder in the ajaxuploadTarget parameter i.e. by the username.