Have you ever faced an error while uploading a logo, any image, or customer attribute image type from the admin side on Magento 2.3?
It says,
Warning: count(): Parameter must be an array or an object that implements Countable in Uploader.php on line 552
If yes, relatable! I faced the error, fixed it, and am posting the solution here for my readers.
To solve the above error of Count(): Parameter must be an Array or an Object That Implements Countable in Magento 2.3, check the below solution:
Solution for Count(): Parameter must be an Array or an Object That Implements Countable in Magento 2.3
In the file-uploader.js, at pub\static\adminhtml\Magento\backend\en_US\Magento_Ui\js\form\element
Replace the code of function processFile with below code:
processFile: function (file) {
file.previewType = this.getFilePreviewType(file);
if (!file.id && file.name) {
file.id = file.name;
}
this.observe.call(file, true, [
'previewWidth',
'previewHeight'
]);
return file;
},
It is the pubstatic file, so you can check by updating quickly.
You also need to update the main file
vendor\magento\module-ui\view\base\web\js\form\element\file-uploader.js
That’s it.
With the above method, you will get rid of the error.
However, you may face another error of Uncaught ReferenceError: Base64 is not Defined in Magento 2.3. Do not worry as I have posted the solution for the same.
Check – Solved: Uncaught ReferenceError: Base64 is not Defined in Magento 2.3
I would be happy to help.
Feel free to share the solution with Magento community via social media.
Thank you.