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

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');
| improve this answer | |
  • Thaks but i want to get file from web directory from module in magento 2 – Deep Shah Aug 13 at 5:34
  • 1
    yes you can inject your block and get it ... – Sameer Bhayani Aug 13 at 5:37

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.