ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

Make File Upload optional

hanshansen 14 Jul, 2020
Hello,

I have built a simple form with an upload file field. But how to get this file field OPTIONAL when I (have to) use a "Upload Files Action"?

For this file field I need to use a special upload path, so I set up the "Upload Files Action" and set the needed path there.
If I upload a file, everything works fine: the file is uploaded to the right destination. Mail is sent with file as attachment.

But when I do this, the Upload File Field becomes requiered.
That means, if I leave the File Upload Field empty, the "Fail Section" of the "Upload Files Action" starts working and won't send anything.

You can see this in the Debug below.

If I disable the "Upload Files Action" everything works fine. But the files will be uploaded to the standard path, which I can not use.

What should I do, to use my own upload path and let the upload file field optional?

"Upload Files" in the form settings is disabled.
Array
(
    [chronoform] => kontaktformular
    [event] => submit
    [anrede] => Frau
    [vorname] => Franz
    [name] => Franziskus
    [mail] => franzi@gmx.de
    [nachricht] => Some Text
    [upload] => Array
        (
            [0] => 
        )

    [datenschutz] => Ja, Datenschutzbestimmungen bestätigt
    [g-recaptcha-response] => 03AGdBq24LAxCb9YDYp-Awz_F-K0r13PPddHdeBlYL8zEjMLh053YFp5cOgzmfF1ZBNWQBeRblKNGWuDxgto4oT8AP7tX1o-7COA2e95R3nEzth4I3Lub-bby5Ao_7Ua-qDuF0LeNXcQtUXLb2Rl9QVH-R6QCozEnQfA-9bjs0kDvVmF-nJfovSqQJkX0aETPNUMAGZnwS7__k5N83A8Kp4lEVG1Y11EcBpLVGdx48z1WI-xdAlAB3pR7iKlk0Sg2XT71a8Loactg0gp2k3c_mtEG-b7oeH2ogSl9dvwny7SQHIofr3ecAcjg6pEu4Vkb__lR3qBsHTFkY54gxUpMEcQixsnlYiVXJ1tCrmZxKSJoFcF3PUbE3pRWB3CEwEb69zVenKUIuZ9BVuI3qoVoY03QicdfiDMc8Kg
    [senden] => 
    [18ddd5495977d5f0fe59737d4a8bc7ac] => 4228615ad84855e7e75a314a23c3d34b
    [8e09a5d713c3498e327595c69dfd40a0] => 2e546fbb0cb2a001c5ed76e5aa4305bf
    [Itemid] => 114
    [option] => com_content
    [view] => article
    [id] => 72
    [kontaktformular] => 
)
Array
(
    [submit_validate_fields] => Array
        (
            [log] => Automatic validation enabled.
            [var] => 1
        )

    [upload13] => Array
        (
            [path] => /the-whole-other-path/formular-uploads/
            [upload.[n]] => Array
                (
                    [extensions] => Array
                        (
                            [0] => jpg
                            [1] => jpeg
                            [2] => png
                            [3] => pdf
                            [4] => doc
                            [5] => docx
                        )

                )

            [upload.0] => Array
                (
                    [saved] => 0
                )

            [var] => Array
                (
                    [upload] => Array
                        (
                            [0] => Array
                                (
                                )

                        )

                )

        )

)
Max_admin 16 Jul, 2020
Remove the upload files action and enable the "Upload files" setting in the form settings area, assuming you have the latest v6 update and your form is in the v6.1 mode

Better if you are building a new form to use v7

Best regards
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
hanshansen 16 Jul, 2020
Hello Max,

thank you for your quick response.

When I remove the UploadFilesAction, where do I edit the indiviual path? The Files shouldn't be stored in the standard Chronoforms path, I wanna save them elsewhere.

I thought the UploadFilesAction is the best thing to do this, to set an individual path to store the uploaded files.
But this action requires a success AND fail section. So if nothing is uploaded (because this field ist optional), then the action sets this as "failed" and loads for example an event loader.
This topic is locked and no more replies can be posted.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com