0

I want to get csv file from web folder of custom module in magento 2 so how can i do this. please help me.

Thanks In Advance.

1 Answer 1

1

There are several ways to get it. Just matter is that in which file you want to get.

If you want to get it in phtml file then

$block->getViewFileUrl('VendorName_ModuleName::csvdirectory/file.csv');

From Block you may get via

$this->getViewFileUrl('VendorName_ModuleName::csvdirectory/file.csv');
2
  • Thaks but i want to get file from web directory from module in magento 2
    – Deep Shah
    Commented Aug 13, 2020 at 5:34
  • 1
    yes you can inject your block and get it ... Commented Aug 13, 2020 at 5:37

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.