Files
2026-09-15 10:26:34 +08:00

32 lines
915 B
PHP

<?php
namespace Stemcell\Customer\Controller\Adminhtml\Salesperson;
use Magento\Framework\App\Action\HttpGetActionInterface;
class Sample implements HttpGetActionInterface
{
protected \Magento\Framework\App\Response\Http\FileFactory $fileFactory;
private \Magento\Framework\Module\Dir $moduleDir;
public function __construct(
\Magento\Framework\App\Response\Http\FileFactory $fileFactory,
\Magento\Framework\Module\Dir $moduleDir
) {
$this->fileFactory = $fileFactory;
$this->moduleDir = $moduleDir;
}
/**
* @throws \Exception
*/
public function execute()
{
$file = $this->moduleDir->getDir('Stemcell_Customer').'/data/sample/salesperson.xlsx';
$content['type'] = 'filename';
$content['value'] = $file;
$content['rm'] = 0;
return $this->fileFactory->create('salesperson.xlsx', $content);
}
}