2

I want to override public static function getCorrectFileName method of Magento\Framework\File\Uploader, I have check with Preference and Plugin but it is not working for me.

Anyone have idea about this ?

4

1 Answer 1

2

Overwriting a static method is impossible, because the interpreter call them using a class name directly, so no one preference could get around this logic. It is a PHP restriction, not Magento. You can create a similar module\class and use it instead of the base Magento module\class.

3
  • Yes right @Siarhey Uchukhlebau, I have do another way and it working fine. Jan 27, 2020 at 11:45
  • @NiranjanGondaliya Can you let me know how did you achieve it? I need to increase filename length condition to 128 instead of 90 in that static function. Jan 31, 2021 at 20:16
  • @NiranjanGondaliya How did you go about extending or overwriting this method? Jul 15, 2021 at 19:15

Your Answer

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

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