heilр!
ho due files:
visualizza.php
actions.php
in visualizza ho la lista dei file da fare il download.
actions ш il file che fa eseguire il download.
se io passo le variabili "id" e "action" ad actions.php in questo modo:
i file .doc e pdf si aprono regolarmente.codice:<a href=\"actions.php?action=download&id={$result["id_manu"]}\">download</a>
Mentre se passo le variabili come a me servirebbe cioш:
il download non funziona piu!codice:<a href=\"index.php?page=auth/actions&action=download&id={$result["id_manu"]}\">download</a></td>
o meglio mi apre il file ma mi visualizza all'inizio un pezzo della pagina html e poi accodato ho il file doc.
le variabili "id" e "action" vengono passate regolarmente e actions.php ш lo stesso file in tutti e 2 i casi.
perchшшш???codice:<?php if(!isset($_GET)) $_GET = $HTTP_GET_VARS; if($_GET["action"] && $_GET["id"] && is_numeric($_GET["id"])) { // CONNESSIONE AL MYSQL @mysql_connect("localhost", "root", "") or die("Connessione fallita !"); // SELEZIONE DATABASE @mysql_select_db("autenticazione") or die("Selezione Database fallita !"); switch($_GET["action"]) { // VISUALIZZAZIONE case "view" : $query = "SELECT * FROM manuali WHERE id_manu = '" . $_GET["id"] . "'"; $select = @mysql_query($query) or die("Query fallita !"); $result = @mysql_fetch_array($select); $data = $result["bin_data"]; $type = $result["filetype"]; Header("Content-type: $type"); echo $data; break; // DOWNLOAD case "download" : $query = "SELECT * FROM manuali WHERE id_manu = '" . $_GET["id"] . "'"; $select = @mysql_query($query) or die("Query fallita !"); $result = @mysql_fetch_array($select); $data = $result["bin_data"]; $name = $result["filename"]; $type = $result["filetype"]; // 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 ?>![]()
![]()

Rispondi quotando