file upload not working

dadoonan 14 Feb, 2015
The form I'm working on is writing the uploaded file name to the database but the file itself is not being uploaded.

The field name in the database is Upload, which is used in the form as the Field Name and Field ID.

The files upload action is enabled and is configured with Upload:pdf-doc-docx-txt

The permissions for the /components/com_chronoforms5/chronoforms/uploads/ form name here folder is set to 755.

The debugging reveals:

[0] => INSERT INTO `maz56_chronoengine_chronoforms_datatable_EducationalSubmission` (`Name`, `Email`, `City`, `State`, `Title`, `URLclient`, `Upload`, `user_id`, `uniq_id`, `created`) values ('david', 'xxxxx@gmail.com', 'green', 'dfaf', '', 'If your exercise is available on the web, please enter the full url.', 'site-map.doc', '0', '1972116d46d5a0607fc3e553629937d29456a366', '2015-02-14 20:19:59');

What am I missing?

david
dadoonan 14 Feb, 2015
I followed the tutorial on "How can I add a file upload to my form?" before submitting my question.

I am using action / html render form / form method / Post.

Changing Post to File does allow the file to be uploaded, however it's file name is not saved to the db.

????
Max_admin 15 Feb, 2015
Hi dadoonan,

The form method should always be set to "File", do you have field in your table to store the file's name ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
dadoonan 15 Feb, 2015
There is a field called Upload that stores the file name.

If the method is set to post, the file name is written to the db.

If the form method should be set to File, what needs to be done to save the file name?
david
GreyHead 15 Feb, 2015
Hi David,

How do you know that the file hasn't been uploaded? If the file name is there - and it is - then ChronoForms has found the file and tried to move it to the location you set in the Upload files action.

Please drag a Debugger action into the On Submit event, then submit the form and post the debug results here.

Bob
dadoonan 15 Feb, 2015
I'm able to confirm a file being uploaded by watching the default upload location via FTP.

The debug results are below. This test was done using "File" as the action. What I am missing to ensure that the Upload file name is written to the db? Do I need to change the field name in the database from "Upload" to something else?

One more question ... Why do the uploaded files have a random numerical prefix added?



Data Array
Array
(
    [option] => com_chronoforms5
    [chronoform] => EducationalSubmission
    [event] => submit
    [Name] => david
    [Email] => dadoonan@gmail.com
    [City] => lancaster
    [State] => pa
    [Title] => sunday 10 27
    [URLclient] => 
    [Submit] => Submit
    [ip_address] => 67.248.251.75
    [id] => 49
    [Upload] => 20150215152750_debug-as-requested.pdf
)
Array
(
    [Upload] => Array
        (
            [name] => 20150215152750_debug-as-requested.pdf
            [original_name] => debug-as-requested.pdf
            [path] => /home/acase/acase.org/forum/components/com_chronoforms5/chronoforms/uploads/EducationalSubmission/20150215152750_debug-as-requested.pdf
            [size] => 82710
            [link] => /home/acase/acase.org/forum/components/com_chronoforms5/chronoforms/uploads/EducationalSubmission/20150215152750_debug-as-requested.pdf
        )

)
Errors
Array
(
)
Debug Info
Array
(
    [1] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:dadoonan@gmail.com, dadoonan@mac.com
                    [2] => Subject:chronoforms test
                    [3] => From name:ACASE Forum
                    [4] => From email:dadoonan@mac.com
                    [5] => CC:
                    [6] => BCC:
                    [7] => Reply name:ACASE
                    [8] => Reply email:dadoonan@gmail.com
                    [9] => Attachments:
                    [10] => Body:
<table>
<tr><td>Name</td><td>david</td></tr>
<tr><td>Email</td><td>dadoonan@gmail.com</td></tr>
<tr><td>City</td><td></td></tr>
<tr><td>State</td><td>pa</td></tr>
<tr><td>Exercise Title</td><td>sunday 10 27</td></tr>
<tr><td>URL</td><td></td></tr>
<tr><td>Upload</td><td></td></tr>
<tr><td>Enter Code</td><td></td></tr>
<tr><td>Reviewer Name</td><td></td></tr>
<tr><td>Review Date</td><td></td></tr>
<tr><td>Date review sent to client</td><td></td></tr>
<tr><td>URL</td><td></td></tr>
<tr><td>Review File</td><td></td></tr>
<tr><td>Review Response</td><td></td></tr>
</table><br /><br />IP: 67.248.251.75
                )

        )

    [3] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Array
                        (
                            [0] => INSERT INTO `maz56_chronoengine_chronoforms_datatable_EducationalSubmission` (`Name`, `Email`, `City`, `State`, `Title`, `URLclient`, `user_id`, `uniq_id`, `created`) values ('david', 'dadoonan@gmail.com', 'lancaster', 'pa', 'sunday 10 27', '', '0', '2d2f5cbec9b4488faa0c7f8e5b5bfa77c36a5e17', '2015-02-15 15:27:50');
                        )

                )

        )

    [6] => Array
        (
            [Files Upload] => Array
                (
                    [0] => Upload routine started for file upload by : Upload
                    [1] => /home/acase/acase.org/forum/components/com_chronoforms5/chronoforms/uploads/EducationalSubmission/20150215152750_debug-as-requested.pdf has been uploaded successfully.
                )

        )

)
GreyHead 15 Feb, 2015
Answer
Hi David,

To start at the end ChronoForms adds a date-time string at the start of the name so that if all your users submit files called my-best-selfie.png then they don't over-write each other.

I can see that your file is uploading OK - I can see the pdf on your server exactly as expected.

In the first debug database query the value looks OK
`Upload` = 'site-map.doc'


In the latest debugger out put there is no entry for Upload in the column names list which is odder.

Is the DB Save after the Upload Files action it needs to be, otherwise there is no file to record? If it is, is there any other action in between the two that might change something? And is there an Upload column in the table you are now using?

Bob
dadoonan 15 Feb, 2015
Thanks GreyHead.

Switching the order of the file upload and save to db did the trick.

thanks for all your help.
This topic is locked and no more replies can be posted.