Ver Mensaje Individual
  #3 (permalink)  
Antiguo 07/01/2014, 11:50
Avatar de enlinea777
enlinea777
 
Fecha de Ingreso: mayo-2008
Ubicación: frente al pc
Mensajes: 1.830
Antigüedad: 16 años
Puntos: 127
Respuesta: Problema con links para descargar archivos del servidor

aqui esta el error
Código PHP:
header("Content-type: application/octet-stream"); 
hay otras opciones para header
Código PHP:
header("Content-Length: " filesize($filename));
header("Content-Disposition: attachment; filename=$filename"); // con esto forsamos la descarga
header('Content-Transfer-Encoding: binary'); 
y para decirle el tipode archivo puede usar esto
Código PHP:
function get_mime($file) {
  if (
function_exists("finfo_file")) {
    
$finfo finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
    
$mime finfo_file($finfo$file);
    
finfo_close($finfo);
    return 
$mime;
  } else if (
function_exists("mime_content_type")) {
    return 
mime_content_type($file);
  } else if (!
stristr(ini_get("disable_functions"), "shell_exec")) {
    
// http://stackoverflow.com/a/134930/1593459
    
$file escapeshellarg($file);
    
$mime shell_exec("file -bi " $file);
    return 
$mime;
  } else {
    return 
false;
  }
}
 
header("Content-type: get_mime($filename)");