Salve....
ho seguito il manuale che ho trovato su questo sito per visualizzare le immagini registrate dentro il data base, ma ho un problema nella visualizzazione:
questo è il codice:
codice:<?php if(!isset($_GET)) $_GET = $HTTP_GET_VARS; if($_GET["action"] && $_GET["Id"] && is_numeric($_GET["Id"])) { // CONNESSIONE AL MYSQL @mysql_connect("host", "user", "password") or die("Connessione fallita !"); // SELEZIONE DATABASE @mysql_select_db("FileBinari") or die("Selezione Database fallita !"); switch($_GET["action"]) { // VISUALIZZAZIONE case "view" : $query = "SELECT DatiBinari, Type FROM file_binari WHERE Id = '" . $_GET["Id"] . "'"; $select = @mysql_query($query) or die("Query fallita !"); $result = @mysql_fetch_array($select); $data = $result["DatiBinari"]; $type = $result["Type"]; Header("Content-type: $type"); echo $data; break; // DOWNLOAD case "download" : $query = "SELECT DatiBinari, Nome, Type FROM file_binari WHERE Id = '" . $_GET["Id"] . "'"; $select = @mysql_query($query) or die("Query fallita !"); $result = @mysql_fetch_array($select); $data = $result["DatiBinari"]; $name = $result["Nome"]; $type = $result["Type"]; // SE IL BROWSER E' INTERNET EXPLORER if(ereg("MSIE ([0-9].[0-9]{1,2})", $_SERVER["HTTP_USER_AGENT"])) { header("Content-Type: application/octetstream"); header("Content-Disposition: inline; filename=$name"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Pragma: public"); } else { header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=$name"); header("Expires: 0"); header("Pragma: no-cache"); } echo $data; break; default : // DEFAULT CASE, NESSUNA AZIONE break; } // endswitch // CHIUDIAMO LA CONNESSIONE @mysql_close(); } //endif ?>
quando lo vado ad eseguire mi esce un errore
Warning: Cannot modify header information - headers already sent by (output started at /home/secaleys/public_html/macbbb/php/news/prova.php:1) in /home/secaleys/public_html/macbbb/php/news/prova.php on line 26
e sotto mi esce il testo con il binario del file...
Qualcuno mi può aiutare????


Rispondi quotando