buenas noches,
he puesto la posibilidad de descargar archivos en una web, y me gustaría saber si es segura:
Código HTML:
Ver original<a href="http://www.nombredelaweb.com/ruta/descarga.php?archivo=<%=archivos[j][2]%>&ubicar=correou"><%=archivos[j][2]%></a>
Código PHP:
Ver original<?php
if (!isset($_GET['archivo']) || empty($_GET['archivo'])) {
}
$ubicar = $_GET['ubicar'];
define('BASE_IMAG', 'rutafisicadelacarpetaenelservidor'); $root = BASE_IMAG.DIRECTORY_SEPARATOR.$ubicar.DIRECTORY_SEPARATOR;
$path = $root.$file;
$type = '';
{
{
}
{
}
if ($type == '')
{
$type = "application/force-download";
}
// Definir headers
header("Content-Type: $type"); header("Content-Disposition: attachment; filename=$file"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $size);
// Descargar archivo
}
else
{
die("El archivo no existe."); }
?>
un saludo.