Forums

No Attachments and Error on Line 94 o file_upload.php

rholzler 18 Apr, 2016
We are not receiving file attachments. Checking the upload folder, the attachments are not being saved there either.

Here is the debugger output, including the custom debugger code you recommended in an alternate post with a similar topic. We also turned the Display Errors ON while performing the test.

In the test below, the file type should have been rejected based on the file type, but we can deal with that after we get the files uploading.

Warning: Invalid argument supplied for foreach() in /home/massarok/public_html/administrator/components/com_chronoforms5/chronoforms/actions/file_upload/file_upload.php on line 94

Array
(
    [chronoform] => ApplyNow
    [event] => submit
    [name] => Robert Holzler
    [email] => [REMOVED_FOR_POST]
    [phone] => 
    [message] => 
    [recaptcha_challenge_field] => 03AHJ_VutPxul10EcGhyVjVe8BoUx21Ke6paCJi3VyrJ2uZR9GEvEElUmWWNA1S7elhDeeu0w-2D-PFa4TOIjx8l15jwF9g7TNp-DlWOq8oCjcHjvsQ0VOtHqgTLo6MCHmnRGNYrypgAavnJt_XHmshZjRIw_sL-TyTuyWqPOGhaDsXdeXYf9ZgRky-ImNoCjuFP3YMzjvg6Y-T6AbqBby_8ihVfvUCFm3waJFPDFZHglwNmo0ok4ka1PbBd7L0HC9CqiStsUaV2WV9_aQSBfsSy9iBjTGBShohw
    [recaptcha_response_field] => Overhill
    [button6] => Submit Application Now
    [id] => 10
    [ip_address] => 173.10.xxx.xxx
)

Array
(
)

Errors

Array
(
)

Debug Info

Array
(
    [11] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Array
                        (
                            [0] => INSERT INTO `vvGld_chronoengine_chronoforms_datatable_ApplyNow` (`name`, `email`, `phone`, `message`, `button6`, `user_id`, `uniq_id`, `created`) values ('Robert Holzler', '[REMOVED_FOR_POST]', '', '', 'Submit Application Now', '0', '159d80de8b5f95322d54f99e2acbb43bbbfa07ca', '2016-04-18 17:14:43');
                        )

                )

        )

    [0] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:r[REMOVED_FOR_POST]
                    [2] => Subject:Massaro Kozak Art Scholarship Fund Contact Form
                    [3] => From name:MKS Website CMS
                    [4] => From email:[REMOVED_FOR_POST]
                    [5] => CC:
                    [6] => BCC:
                    [7] => Reply name:
                    [8] => Reply email:
                    [9] => Attachments:
                    [10] => Array
                        (
                        )

                    [11] => Body:
<table>
<tr><td>Name</td><td>Robert Holzler</td></tr>
<tr><td>Email</td><td>[REMOVED_FOR_POST]</td></tr>
<tr><td>Phone</td><td></td></tr>
<tr><td>Attach File</td><td></td></tr>
<tr><td>Message</td><td></td></tr>
<tr><td>Enter Code</td><td></td></tr>
</table><br /><br />IP: 173.10.xxx.xxx
                )

        )

)

$_FILES: Array ( [file1] => Array ( [name] => AachenStd-Bold.otf [type] => application/octet-stream [tmp_name] => /chroot/tmp/phpHzi3xF [error] => 0 [size] => 31672 ) ) 
GreyHead 18 Apr, 2016
Hi rholzler,

The $_FILES array tells me that a file has been uploaded but I don't see any trace of the form element used to upload it, or - apart from the PHP Warning - that a Files Upload action is doing anything.

What is the name of the File Field element and how do you have the Files Upload action configured?

Bob
rholzler 18 Apr, 2016
From the Designer Tab > File Upload
--Field Name: file1
--File ID: file1
--Tool Tip: File Types: txt, doc, docx, rtf, pdf<br />All scholarship applications must include an essay describing why they should be considered for this scholarship.
--Validation > Required: Yes
--Validation > Image: No

---------
From the Setup Tab

-On Submit
-Handle Arrays (nothing configured here)
-Check ReCaptcha (event loop on fail)

-Files Upload
--On Success is empty
--On fail is empty. Tried with Event Loop here with same result.
---Enabled: Yes
---Files config: file1:txt-doc-docx-rtf-pdf
---Max file size: 4096
---Min file size: 5
---Error messages not changed
---Array fields: file1
---Extensions separator: -

--DB Save
--Display Message
--Debugger (disabled at the moment)
GreyHead 19 Apr, 2016
Answer
Hi rholzler,

Please try removing the file1 from the Array Fields box in the Files Upload action. The files element isn’t returning an array so I think this may be the problem.

Bob
rholzler 19 Apr, 2016
Perfect. That resolved all three problems. The attachments arrive by email, they are saved on the server and the file type error message is now working.

So, basically you only put the filed names in the array field when there are more than one file uploads?
GreyHead 19 Apr, 2016
Hi rholzer,

Not quite, you use the Array Field when you have multiple uploads with the same name - you can do this by setting Multiple to Yes in the File Field element and giving the element an array name like file1[]

If you have multiple File Fields with different names then you treat them as plain ordinary uploads.

Bob
This topic is locked and no more replies can be posted.