Forums

on submit, file uploads but filename not saved in db (debug included)

kgriffin 12 Aug, 2021
Hi-

Here is the debugging output on submit. Note the file name for 'teacher_rec' is present in the initial array of the form, but not in the array that saves to the db. The file uploads no problem and can be found in the directory as expected if you go to the directory manually, but, to state the obvious, the file cannot be downloaded using the download action.

I have "save data" for the field.
I have the upload action listed prior to the save action.

What am I missing?

Thanks.
Array
(
    [chronoform] => currscholapp_committee
    [gpage] => save
    [aid] => 574
    [Itemid] => 491
    [option] => com_chronoforms7
    [view] => form
    [scholapp] => Array
        (
            [aid] => 574
            [mailing_same_as_street] => 
            [teacher_rec_received] => y
            [select_category0] => 
            [select_category1] => 
            [invited_to_audition] => y
            [title] => 
            [title_2] => 
            [accompanist_name] => 
            [judge_summaries] => 
            [title_of_award] => 
            [amount_of_award] => 
            [link_to_scholarship_performance] => 
            [scholarship_awardee] => 
            [teacher_rec] => 20210812202338_pet-agreement-westlake.pdf
        )

    [AppJSNInfo] => Array
        (
            [age2] => 13
        )

    [__cf_token] => 57fadbe0-5b93-40df-a85d-addedb2e1ab8
)
Array
(
    [upload_477] => Array
        (
            [path] => /home2/kgriffin/vm.florida-flair.com/components/com_chronoforms7/chronoforms/uploads/scholarship/
            [scholapp] => Array
                (
                    [teacher_rec] => Array
                        (
                            [extensions] => Array
                                (
                                    [0] => jpg
                                    [1] => jpeg
                                    [2] => pdf
                                )

                            [saved] => false
                        )

                )

            [var] => false
        )

    [save_data_379] => Array
        (
            [result] => Data saved successfully!
            [dataset] => Array
                (
                    [aid] => 574
                    [mailing_same_as_street] => 
                    [teacher_rec_received] => y
                    [select_category0] => 
                    [select_category1] => 
                    [invited_to_audition] => y
                    [title] => 
                    [title_2] => 
                    [accompanist_name] => 
                    [judge_summaries] => 
                    [title_of_award] => 
                    [amount_of_award] => 
                    [link_to_scholarship_performance] => 
                    [scholarship_awardee] => 
                    [teacher_rec] => 
                )

            [log] => Array
                (
                    [0] => INSERT INTO `u6fdn_chronoforms_data_schol_app` (`aid`, `teacher_rec_received`, `select_category0`, `select_category1`, `invited_to_audition`, `title`, `title_2`, `accompanist_name`, `judge_summaries`, `title_of_award`, `amount_of_award`, `link_to_scholarship_performance`, `scholarship_awardee`, `teacher_rec`)  values  ('574', 'y', '', '', 'y', '', '', '', '', '', '', '', '', '') ON DUPLICATE KEY UPDATE `aid` = '574',`teacher_rec_received` = 'y',`select_category0` = '',`select_category1` = '',`invited_to_audition` = 'y',`title` = '',`title_2` = '',`accompanist_name` = '',`judge_summaries` = '',`title_of_award` = '',`amount_of_award` = '',`link_to_scholarship_performance` = '',`scholarship_awardee` = '',`teacher_rec` = '';
                )

            [var] => Array
                (
                    [aid] => 574
                    [teacher_rec_received] => y
                    [select_category0] => 
                    [select_category1] => 
                    [invited_to_audition] => y
                    [title] => 
                    [title_2] => 
                    [accompanist_name] => 
                    [judge_summaries] => 
                    [title_of_award] => 
                    [amount_of_award] => 
                    [link_to_scholarship_performance] => 
                    [scholarship_awardee] => 
                    [teacher_rec] => 
                )

        )

    [Application_upload] => Array
        (
            [path] => /home2/kgriffin/vm.florida-flair.com/components/com_chronoforms7/chronoforms/uploads/scholarship/
            [scholapp] => Array
                (
                    [teacher_rec] => Array
                        (
                            [extensions] => Array
                                (
                                    [0] => jpg
                                    [1] => jpeg
                                    [2] => pdf
                                )

                            [saved] => true
                        )
kgriffin 13 Aug, 2021

UPDATE: I attempted to force a save by adding a data source using {var:upload_xxx.file.name} as the value for teacher_rec and ended up with the same result.

Any suggestions on this are appreciated.
kgriffin 13 Aug, 2021
Answer
Okay. I got it all to work when, for each file I wanted to upload, I created a separate hidden text field whose value is set to {var:upload_xxx.file.name} and an upload button that submits to a unique page with an upload action that has a page loader on fail (because, for whatever reason, the upload action does not recognize that a file has been uploaded) that reloads the form, followed by a save action for the form that redirects back to the form on success.

That seems like a very complicated way to save the file name into the db so that the file can then be downloaded, but at least it works.

If there is an easier way to do this, I would love to know. Thanks.
You need to login to be able to post a reply.