tengo una wb el la cual los usuarios se descarguaen archivos(de cualkier extension)
el problema es ke me sale el dialogo pero no descarga el archivo deseado y para colomo el explorer me bloquea la descarga.
aki dejo el codigo a ver si alguien me podria ayudar.
gracias por adelantado y perdonad la ignorancia.
Código PHP:
<?php
$release=$_GET['release'];
header ("Content-Disposition: attachment; filename=".$release." ");
header ("Content-Type: application/octet-stream");
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/download");
header("Content-Transfer-Encoding: binary ");
readfile('./xampp/htdocs/$release');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />-->
<title>Error al descargar el archivo</title>
</head>
<body>
<p>No se ha podido descargar el archivo</p>
</body>
</html>
<html>
<head>
<title>Descarga de archivo</title>
</head>
<body>
<h1>Descarga de archivo</h1>
<?php
$p = $_GET["nomprod"];
$v = $_GET["version"];
$t = $_GET["tipo"];
echo"$p</br>";
echo"$v</br>";
echo"$t</br>";
//CONTAPLUS
if($p=="contaplus"){
if($v=="basico"){
switch($t){
case H:
$release="contaplus_basico_ayuda.txt";break;
case I:
$release="contaplus_basico_informacion.txt";break;
case A:
$release="contaplus_basico_actualizacion.exe";brea k;
}
}
if($v=="profesional"){
switch($t){
case H:
$release="contaplus_profesional_ayuda.txt";break;
case I:
$release="contaplus_profesional_informacion.txt";b reak;
case A:
$release="contaplus_profesional_actualizacion.exe" ;break;
}
}
if($v=="elite"){
switch($t){
case H:
$release="contaplus_elite_ayuda.txt";break;
case I:
$release="contaplus_elite_informacion.txt";break;
case A:
$release="contaplus_elite_actualizacion.exe";break ;
}
}
if($v=="evolution"){
switch($t){
case H:
$release="contaplus_evolution_ayuda.txt";break;
case I:
$release="contaplus_evolution_informacion.txt";bre ak;
case A:
$release="contaplus_evolution_actualizacion.exe";b reak;
}
}
}//fin CONTAPLUS
echo"$release";
?>
<script>
document.location.href="descarga4.php?release=<?ec ho $release?>";
</script>
<?
?>
</body>
</html>
bueno por lo menos porke me pasa eso:
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\descarga4.php:2) in C:\xampp\htdocs\descarga4.php on line 6
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\descarga4.php:2) in C:\xampp\htdocs\descarga4.php on line 7
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\descarga4.php:2) in C:\xampp\htdocs\descarga4.php on line 9
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\descarga4.php:2) in C:\xampp\htdocs\descarga4.php on line 10
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\descarga4.php:2) in C:\xampp\htdocs\descarga4.php on line 11
Warning: readfile(./htdocs/contaplus_basico_ayuda.txt) [function.readfile]: failed to open stream: No such file or directory in C:\xampp\htdocs\descarga4.php on line 12
No se ha podido descargar el archivo