I am trying to download a file (in this case an .xls) by means of php and sqli. The file (hello.xls for giving you an example name) is "downloaded" with its correct name but it weighs 0kbs, so it does not grab the file, it just retrieves the name. This program I did not do so the code is half messed up, sorry for that, I attach the condition and where it is called:
Table where it is called:
<tr>
<td width="273" height="22" bgcolor="#F5F5F5" onmouseover="cambiacolor_over(this)" onmouseout="cambiacolor_out2(this)" style="cursor:pointer" onClick="popuppdf(<?php echo $archi['codidocu']?>)"><?php echo @$ur?></td>
</tr>
Condition:
if($extension=="xls" || $extension=="xlsx"){
$exc=$extension;
$sql="select * from documentos where codidocu=".$_GET['pdf']."";
$quer=mysqli_query($con,$sql);
$row=mysqli_fetch_array($quer);
$z=$row["linkdocu"];
$filename =$z;
$url = explode('/',$z);
$ur=@$url[7];
$extension=strtolower(array_pop(explode(".",$ur)));
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: inline; filename="'.$ur.'"');
$arex=substr($z,4);
readfile($arex);
}
Thank you very much for taking the time to read.