5

Actually I'm refering to #19247 for PHP 7.2 specific issue.

that partially solved my issue but can't able to override that file.

I tried using preference here's what I tried. <preference for="Magento\Framework\File\Uploader" type="Vendor\Module\File\Uploader" />

But doesn't seems to work. Any idea ?

4 Answers 4

2

I strongly recommend not use Preferences, because there are other techniques that you could use to update the input or output of a function.

For example, you could write a Before plugin to update the incoming parameters or an After plugin to update the outgoing result.

But in your case, it probably is not possible with a Plugin but then you could use the Composer Patch technique.

More information about Composer Patching in Magento 2 you can find here:

https://support.magento.com/hc/en-us/articles/360005484154-Create-a-patch-for-a-Magento-2-Composer-installation-from-a-GitHub-commit

1

I write at medium a post how to Patch your Magento:

https://medium.com/@LarsRoettig/how-to-apply-patches-on-magento-2-b4fd83537f61

I also don't strongly recommend to not use Preferences same reason as Mr. Lewis.

0

We can override using preference.

  • Create di.xml

  • Create class php file

     <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
     <preference for="vendor\magento\framework\File\Uploader" type="NameSpace\Customer\Framework\File\Uploader" />
    
  • In the given path put your fle NameSpace\Customer\Framework\File\Uploader

0

You can refer to this answer to solve your problem. This solution solves for success page. You can replace those with your file uploader...

Refer Here!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.