Error: main.CRITICAL: Invalid parameter given. A valid $fileId[tmp_name] is expected in Magento 2

Have you ever faced the above-mentioned issue in your local development area? If yes, then we have a solution for you.

Note: This is the temporary solution we don’t recommend changing the core files.

Go to ‘vendor/Magento/Framework/File/Uploader.php’

In function ‘_setUploadField($field)’, comment out ‘$this->validateFileId($field)’ after doing this your function should be simile to following image.


Line numbers in the above screenshot may vary based on your magento version.

Let us know if this solution helped you or not by commenting on our blog

Happy coding 🙂

How to add if condition in transactional emails

Have you ever wonder or faced situation where you want to add condition block in transactional email? If yes, we have solution for you. Please go through all the possible solution.

Solution 1: use depend tag which check whether that variable has some value or not.

{{depend shipping_company}}
               <h1>Your shipment is on its way.</h1>
             <img src="{{media url=wysiwyg/logo-dpd.png}}" alt="" />

If you have some advance condition using block technique.

Solution 2: Block technique for advance conditioning

{{block class='Magento\\Framework\\View\\Element\\Template' 
               area='frontend' template='Codedecorator_Learn::email/shipping_company.phtml' shipping_company=$shipping_company}}

Add above block code in your email template and create new phtml template in your plugin like following:

        if($block->getData('shipping_company') !='dpd') {
                echo $block->getData('shipping_company'); 

I hope above this post help you in your task.

Happy Coding 🙂

How to Add Date Picker in Custom Form

In this post , we are going to see how we can add date picker in custom form at Backend or Frontend.

<div class="admin__field">
      <label for="delivery_date" class="admin__field-label"><?= $block->escapeHtml(__('Shipment Delivery Date')) ?></label>
         <div class="admin__field-control">
           <input name="delivery_date" type="text" class="input-text" id="delivery_date" />
    ], function () {
            dateFormat: 'dd/mm/yy',
            changeMonth: false,
            changeYear: false

We have to add HTML block and javascript code in same phtml to make date picker work. Let us know if you are facing any issue about the same.

Happy Coding 😀

How to Override comment history order in backend

We have recently worked on backed for one of customer who wants additional information in comment history form so we have override the following layout in order to make it work.

We have override both sales_order_view.xml with order_history block name.

<?xml version="1.0"?>
<page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="order_history">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Codedecorator_Learn::order/view/history.phtml</argument>

You can now copy the history.phtml from the core and paste in your module and you can easy customize it or add new fields in your form.

Let’s us know that above code snippets helped your or not. If you have any doubt or any queries. Please do comment in our blog post.

MISCONF Redis is configured to save RDB snapshots

Have you ever faced following problem on the server because of the redis?

MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error

We recently faced this error on our client’s live site server. Here is the solution for the same:

You will need to login into your server using SSH and hit following commands.

$ redis-cli
> config set stop-writes-on-bgsave-error no

I hope these command solve your problem and let us know if you have other solution which worked for you.

Happy coding guys!

Magento 2 : Deprecated Functionality: Function ReflectionType::__toString() is deprecated

If you are stuck with above problem, we have solution for you which mentioned below.

File: vendor/zendframework/zend-code/src/Reflection/ParameterReflection.php
File: vendor/laminas/laminas-code/src/Reflection/ParameterReflection.php

In function detectType() replace line return (string) $type; with return $type->getName();
File: vendor/magento/framework/DB/Sql/UnionExpression.php

In function __toString() replace line $sql = implode($parts, $this->type); with $sql = implode($this->type,$parts);
File: vendor/magento/framework/App/AreaList.php

In function getCodeByFrontName() replace line if ($areaInfo['frontName'] == $frontName) with if (isset($areaInfo) && $areaInfo['frontName'] == $frontName)

I hope this solution help you out and let’s know if you have any doubt or any other solution which worked for you.

Happy Coding!