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 ?


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.

  • Yes right @Siarhey Uchukhlebau, I have do another way and it working fine. – Niranjan Gondaliya Jan 27 '20 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. – Kishan Patadia Jan 31 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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