{"id":1605,"date":"2021-02-28T18:25:56","date_gmt":"2021-02-28T18:25:56","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/solution-count-parameter-must-be-an-array-or-an-object-that-implements-countable-in-magento-2-3\/"},"modified":"2025-05-21T17:08:05","modified_gmt":"2025-05-21T11:38:05","slug":"solution-count-parameter-must-be-an-array-or-an-object-that-implements-countable-in-magento-2-3","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/solution-count-parameter-must-be-an-array-or-an-object-that-implements-countable-in-magento-2-3\/","title":{"rendered":"Solved: Count(): Parameter must be an Array or an Object That Implements Countable in Magento 2.3"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Have you ever faced an error while uploading a logo, any image, or customer attribute image type from the admin side on&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-3-release\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2.3<\/a>?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It says,<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><em><strong>Warning: count(): Parameter must be an array or an object that implements Countable in Uploader.php on line 552&nbsp;<\/strong><\/em><\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">If yes, relatable! I faced the error, fixed it, and am posting the solution here for my readers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To solve the above error of&nbsp;<em><strong>Count(): Parameter must be an Array or an Object That Implements Countable in Magento 2.3,&nbsp;<\/strong><\/em>check the below solution:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Solution for&nbsp;Count(): Parameter must be an Array or an Object That Implements Countable in Magento 2.3<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In the&nbsp;<strong>file-uploader.js<\/strong>, at&nbsp;<strong><strong>pub\\static\\adminhtml\\Magento\\backend\\en_US\\Magento_Ui\\js\\form\\element<\/strong><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Replace the code of function&nbsp;<strong>processFile&nbsp;<\/strong>with below code:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> processFile: function (file) {\n        file.previewType = this.getFilePreviewType(file);\n\n        if (!file.id &amp;&amp; file.name) {\n            file.id = file.name;\n        }\n\n        this.observe.call(file, true, [\n            'previewWidth',\n            'previewHeight'\n        ]);\n\n        return file;\n    },<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It is the&nbsp;<strong>pubstatic<\/strong>&nbsp;file, so you can check by updating quickly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You also need to update the main file<br><strong><strong>vendor\\magento\\module-ui\\view\\base\\web\\js\\form\\element\\file-uploader.js<\/strong><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With the above method, you will get rid of the error.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, you may face another error of&nbsp;<strong>Uncaught ReferenceError: Base64 is not Defined in Magento 2.3<\/strong>. Do not worry as I have posted the solution for the same.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check \u2013&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/solution-uncaught-referenceerror-base64-is-not-defined-in-magento-2-3\/\" target=\"_blank\" rel=\"noreferrer noopener\">Solved: Uncaught ReferenceError: Base64 is not Defined in Magento 2.3<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I would be happy to help.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Feel free to share the solution with Magento community via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever faced an error while uploading a logo, any image, or customer attribute image type from the admin side on&nbsp;Magento 2.3? It says,&#8230;<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1605","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1605"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1605\/revisions"}],"predecessor-version":[{"id":13867,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1605\/revisions\/13867"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}