![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
02/10/2008, 04:58
|
| | Fecha de Ingreso: febrero-2002 Ubicación: Navarra
Mensajes: 701
Antigüedad: 23 años Puntos: 2 | |
Respuesta: problemas al forzar la descarga de un archivo Hola buenas, pue spor una parte tengo tu parte del código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>pruebas</title>
<link href="estilos.css" rel="stylesheet" type="text/css" />
<?
if ($_GET["f"]) {
$ruta = $_GET['f'];
$archivo_arr = explode( "/", $ruta );
$archivo = $archivo_arr[count($archivo_arr) - 1];
if( !file_exists( $ruta ) ) {
die( "No existe $ruta" );
}
header( "Content-Disposition: attachment; filename=".$archivo."");
header( "Content-type: application/octet-stream" );
@readfile( $ruta );
}
?>
y por otro la llamada, este y el otro código están en la misma página, te voy a poner solo el enlace con los datos que manda ya que si pongo todo, es algo lioso.
<a href="archivos2.php?opcion=menu&accion=vermenu&sub id=1&idioma=ingles&f=repositorio/repositorio/ingles/MATERIAL_DE_WRITING.doc&idmen=39">material de writing (word)</a></span> (1.09 MB)</div>
Si añado la ruta f a la dirección web me baja el archivo sin problemas, así que problemas con la ruta no hay.
Un saludo
__________________ asp, php, .net, adaptandose a las necesidades |