从 prestashop 模块下载文件

问题描述 投票:0回答:0

我正在尝试从 prestashop 模块下载文件。为此,我有这段代码。它找到了文件(因为我收到了带有“el file existe”消息的邮件)但没有下载它。

            $directorioActual = _PS_UPLOAD_DIR_;
            $filename = $directorioActual."ejemploCsv.csv";
            if (!file_exists($filename)) {
                mail("[email protected]", "el file no existe", "failed");
            } else {
                mail("[email protected]", "el file si existe", "success");
            }
            
            header('Content-Description: File Transfer');
            header('Content-Type: application/octet-stream');
            header('Content-Disposition: attachment; filename="'.basename($filename).'"');
            header('Content-Length: ' . filesize($filename));
            readfile($filename);

这里是github上的完整源代码:sourcecode

prestashop prestashop-1.7 prestashop-modules
© www.soinside.com 2019 - 2024. All rights reserved.