Ver Mensaje Individual
  #6 (permalink)  
Antiguo 13/09/2006, 09:01
Avatar de stock
stock
 
Fecha de Ingreso: junio-2004
Ubicación: Monterrey NL
Mensajes: 2.390
Antigüedad: 19 años, 10 meses
Puntos: 53
Yeah!! ya lo tengo

aqui les pongo el script completo

Código PHP:
<?

 
if(isset($_GET['id'])) {
    include 
"../admin/util/conecta.php";
    include 
"../admin/util/validaciones.php";

    if(
validaID($_GET['id'])){
        
$extenciones = array("application/msword"=>"doc","application/pdf"=>"pdf","image/jpeg"=>"jpg");
        
        
$sql "SELECT cliente,imagen,imagen_type,imagen_peso FROM casos WHERE id_caso='".$_GET['id']."'";
        
$rs mysql_query($sql,$conn);

        
$file mysql_result($rs,0,"imagen");
        
$type mysql_result($rs,0,"imagen_type");
        
$peso mysql_result($rs,0,"imagen_peso");
        
$nombre mysql_result($rs,0,"cliente");
     
        
header('Content-type: '.$type);
        
header('Content-Transfer-Encoding: Binary');
        
header('Content-length: '.$peso);
        
header('Content-disposition: attachment; filename="'.$nombre.'.'.$extenciones[$type].'"'); 
        echo 
$file;
    }
 }
 
?>