I have an Excel 2007 file (xlsx extension) in a server directory (external to the web root), the question is: How can I download it from a web link?
For more clarity the file is e: \ clients \ company \ prueba.xlsx
I have a website on link
I need to download that xlsx test file via a link in link
I've tried with this code PHP
$archivo = "e:\clientes\empresa\prueba.xlsx";
header('Content-Disposition: attachment; filename=' . $archivo);
header("Content-Type: application/vnd.openxmlformats- officedocument.spreadsheetml.sheet");
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Length: '.filesize($archivo));
readfile($archivo);
The file goes down but when you open it with Excel 2007 it does not recognize it as a valid file.
Thanks for your help