Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/01/2011, 15:15
kyeownz
 
Fecha de Ingreso: diciembre-2009
Mensajes: 20
Antigüedad: 14 años, 4 meses
Puntos: 2
problema con cannot modify header

Hola, ya se que este tema se ha hablado algunas veces pero no lo acabo de entender jeje.
Tengo lo siguiente:
Código PHP:
...</head>
<body>
<?php
if(!empty($_GET['id']) && $_GET['a']=="down" && !empty($_GET['photo'])){
    
$root "images/album/".$_GET['id']."/";
    
$file basename($_GET['photo']);
    
$path $root.$file;
    
$type '';
    
    
$size filesize($path); 
    if (
function_exists('mime_content_type')) {
        
$type mime_content_type($path);
    } else if (
function_exists('finfo_file')) {
        
$info finfo_open(FILEINFO_MIME);
        
$type finfo_file($info$path);
        
finfo_close($info);  
    }
    if (
$type == ''){
        
$type "application/force-download";
    }
    
header("Content-Type: $type");
    
header("Content-Disposition: attachment; filename=\"$file\"");
    
header("Content-Transfer-Encoding: binary");
    
header("Content-Length: ".$size);
    
readfile($path);
    
mysql_close();
    
redirect("galeria.php?id=".$_GET['id']);
    exit;
}
?>
    <div id="page" align="center">...
Y me devuelve lo siguiente:
Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/22_shiva/galeria.php:23) in /Applications/XAMPP/xamppfiles/htdocs/22_shiva/galeria.php on line 45

Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/22_shiva/galeria.php:23) in /Applications/XAMPP/xamppfiles/htdocs/22_shiva/galeria.php on line 46

Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/22_shiva/galeria.php:23) in /Applications/XAMPP/xamppfiles/htdocs/22_shiva/galeria.php on line 47

Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/22_shiva/galeria.php:23) in /Applications/XAMPP/xamppfiles/htdocs/22_shiva/galeria.php on line 48
�����JFIF��������C�      ���C    ��������

Alguien me puede ayudar :<
Muchas gracias!