3

I am checking uploaded file is readable by is_readable function of php but in coding standard check it's shows

The use of function is_readable() is discouraged

same error show ablow all function.

1 Answer 1

5

As per Magento 2 coding standard you should use magento function instead of direct php functions

You can use isReadable() function of class Magento\Framework\Filesystem\Driver\File

Also available other function like use fileGetCsv() for fgetcsv() use fileOpen() for fopen()

You can find more file specific functions from

vendor/magento/framework/Filesystem/Driver/File.php

protected $_fileSystem;

public function __construct(
    ...
    \Magento\Framework\Filesystem\Driver\File $fileSystem,
    ...
) {
    $this->_fileSystem = $fileSystem;
}
1
  • 1
    Working awesome @prince thanks a lot Jun 17, 2020 at 10:37

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.