Error when no files were uploaded to non-required upload field
-
Hi, I ran into an error when submitting a form without a file attached, which caused a 500 error on the server.
This is the error message:
count(): Parameter must be an array or an object that implements Countable in [site_path]/wp-content/plugins/drag-and-drop-multiple-file-upload-contact-form-7/inc/dnd-upload-cf7.php:465
I was able to fix this by added the is_countable() function into the conditional statement. such that the line on 465 looked like this:
$multiple_files = ( ( isset( $_POST[ $name ] ) && is_countable($_POST[ $name ]) && count( $_POST[ $name ] ) > 0 ) ? $_POST[ $name ] : null );
I was hoping that a solution of this nature could be implemented on the next update so that I do not run into this issue when the plugin is updated.
Many Thanks.
- The topic ‘Error when no files were uploaded to non-required upload field’ is closed to new replies.