NO BUG: Uploading more than 8 files fails using Bricks Form

Browser: OperaGX/Chrome/Firefox/IE
OS: Windows

Hi there lovely Community!

I think I found a bug that I was able to replicate on the local setup as well, while developing a site for a client.

So when using Bricks Form element, every time I try to upload more then 8 files - only 8 of them are accessible. I did start to locate the issue by turning on the debug and adding some error.log commands to /wp-content/themes/bricks/includes/integrations/form/init.php

I added this line right before the handle_files() instance like that:

		error_log(print_r($_FILES, true));

		// STEP: Handle files
		$this->uploaded_files = $this->handle_files();

Now what I noticed is that before the files list hits the form/init.php 9th file get’s lost and the array scheme changes.
For files 1-8 the array looks like this:

Array
(
    [name] => Array
        (
            [0] => filename.pdf
        )
    [full_path] => Array
        (
            [0] => filename.pdf
        )
    [type] => Array
        (
            [0] => application/pdf
        )
    [tmp_name] => Array
        (
            [0] => /home/tmp/phpP6B9OR
        )
    [error] => Array
        (
            [0] => 0
        )
    [size] => Array
        (
            [0] => 16651
        )
)

Then 9th file is lost from the list, and all files after that have this scheme:

Array
(
    [name] => filename.pdf
    [full_path] => filename.pdf
    [type] => application/pdf
    [tmp_name] => /home/tmp/phpZfQeiS
    [error] => 0
    [size] => 16915
)

Which makes the handle_files() function throw this error:

PHP Warning: foreach() argument must be of type array|object, string given in /wp-content/themes/bricks/includes/integrations/form/init.php on line 493

Like I said in the intro to this post - this happens both on my hosted website, even though all file limits far exceed amount of files that can be processed (limit is 20) or the size (all files are less then 3MB). That happens also on my local clean setup, built using Local on latest WP (6.4.2) and Bricks (1.9.5).

Let me know what else I can check and I’ll be happy to :heart:

Thanks!

Hi @Szyszeq ,

Can you try doubling your PHP max_file_uploads
Maybe set it to 100 and try.
This seems related to PHP configuration.

Regards,
Jenn

Hey Jenn,

Thanks a lot, seems like upping the max file uploads to 50 let’s me easily send 15 files to the server. A bit not intuitive, but it works :smiley:

Thanks a lot, solved :slight_smile: