5

I have a csv file, i want to put it inside my custom module folder app/code/Vendor/Module but i don't know where to put the csv file inside my custom extension folder, and how to generate link to download this csv file, so i can put the download link inside my a href tag in frontend phtml

6
  • Put your csv files under the folder app/code/Vendor/Files/Sample/
    – Abdul
    Jan 2, 2018 at 7:43
  • are you need file download link admin side or frontend side?
    – Abdul
    Jan 2, 2018 at 7:47
  • @Abdul frontend side Jan 2, 2018 at 8:18
  • You can put files in pub/media as well. So you can generate url for pub/media and put them in the href tag. Jan 2, 2018 at 8:48
  • @nortonuser Please let me know if you have any issue. Jan 2, 2018 at 8:53

1 Answer 1

3

You need to create csv folder inside your area(frontend/adminhtml)

app/code/{Namespace}/{Modulename}/view/{area}/web/csv/en_US.csv

call directly inside template files,

echo $this->getViewFileUrl('Namespace_Modulename::csv/en_US.csv');

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.