Ver Mensaje Individual
  #5 (permalink)  
Antiguo 29/09/2010, 07:10
Avatar de manuga87
manuga87
 
Fecha de Ingreso: febrero-2010
Ubicación: Sevilla
Mensajes: 59
Antigüedad: 15 años
Puntos: 6
Respuesta: Problema dato blob mysql

<?php
session_start(); // Initialize session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg6.php" ?>
<?php
//NOS CONECAMOS A LA BASE DE DATOS
//REMPLAZEN SUS VALOS POR LOS MIOS
mysql_connect(EW_CONN_HOST,EW_CONN_USER,EW_CONN_PA SS) or die("No se pudo conectar a la base de datos");

//SELECCIONAMOS LA BASE DE DATOS CON LA CUAL VAMOS A TRABAJAR CAMBIEN EL VALOR POR LA SUYA
mysql_select_db('talentia_becarios09');

//CONSTRUIMOS LA CONSULTA PARA OBTENER EL DOCUMENTO
$qry="Select * from pagos where ID_PAGO=".$_GET["ID_PAGO"];
$res=mysql_query($qry) or die(mysql_error()." qry::$qry");
$obj=mysql_fetch_object($res);

//OBTENEMOS EL TIPO MIME DEL ARCHIVO ASI EL NAVEGADOR SABRA DE QUE SE TRATA
header("Content-type: {$obj->MIME_DOCUMENTO1}");

//OBTENEMOS EL NOMBRE DEL ARCHIVO POR SI LO QUE SE REQUIERE ES DESCARGARLO
header('Content-Disposition: attachment; filename="'.$obj->N_DOCUMENTO1.'"');

//Y PO ULTIMO SIMPLEMENTE IMPRIMIMOS EL CONTENIDO DEL ARCHIVO
print $obj->documento_adjunto_accion;

//CERRAMOS LA CONEXION
mysql_close();
?>