Solved: Count(): Parameter must be an Array or an Object That Implements Countable in Magento 2.3
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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 pub\static 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
If you have any doubts regarding this error, do mention them in the Comment section below.
I would be happy to help.
Feel free to share the solution with Magento community via social media.
Thank you.
Jignesh Parmar
An expert in his field, Jignesh is the team leader at Meetanshi and a certified Magento developer. His passion for Magento has inspired others in the team too. Apart from work, he is a cricket lover.
Prev
How to Update Product Price and Special Price Using CSV in Magento 2
Meetanshi Magento Extensions Launches and Updates February[2021]
Next