Ver Mensaje Individual
  #7 (permalink)  
Antiguo 19/08/2013, 11:04
omarinfinito
 
Fecha de Ingreso: enero-2012
Ubicación: <?php echo"Los teques"; ?>/////estado miranda
Mensajes: 196
Antigüedad: 12 años, 3 meses
Puntos: 9
Respuesta: Forzar descarga sin el uso de href

Crea un archivo llamado, download.php y pon esto

Código PHP:
Ver original
  1. <?php
  2. $file = $_GET['file'];
  3. header("Content-disposition: attachment; filename=$file");
  4. header("Content-type: application/octet-stream");
  5. readfile($file);
  6. ?>

ahora crea otro llamado, iframe.php y pon esto

Código PHP:
Ver original
  1. <script>
  2. window.onload = function(){
  3.   document.getElementById("autoid").click();
  4. }
  5. </script>
  6.  
  7. <a href="http://tuweb.com/download.php?=<?php echo $_GET['file'];  ?>" id="autoid"></a>

y en la linea del iframe pon esto

Código PHP:
Ver original
  1. echo "<iframe style='display:none;' src='http://tuwe.com/iframe.php?file=".$file."'></iframe>";

avisame si te funciono...