Foros del Web » Programando para Internet » PHP »

Download en PHP

Estas en el tema de Download en PHP en el foro de PHP en Foros del Web. Hola, andaba necesitando su hayuda, en mi pagina web mediante un codigo en php puse un boton para poder subir archivos, anda inpecable, pero no ...
  #1 (permalink)  
Antiguo 01/07/2009, 21:42
 
Fecha de Ingreso: marzo-2009
Mensajes: 7
Antigüedad: 15 años, 1 mes
Puntos: 0
Pregunta Download en PHP

Hola, andaba necesitando su hayuda, en mi pagina web mediante un codigo en php puse un boton para poder subir archivos, anda inpecable, pero no se como hacer para que desde la pagina web puedan ver los archivos que se subieron y poder bajarlos, espero su respuesta y desde ya muchas gracias.

Maxi.
  #2 (permalink)  
Antiguo 01/07/2009, 21:44
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: Download en PHP

Revisa los Aportes del foro: http://www.forosdelweb.com/f18/aport...as-php-569025/ hay un aporte de un centro de descargas que podrías estudiar.

Saludos.
  #3 (permalink)  
Antiguo 02/07/2009, 11:26
 
Fecha de Ingreso: marzo-2009
Mensajes: 7
Antigüedad: 15 años, 1 mes
Puntos: 0
Respuesta: Download en PHP

No, no encontre ahí lo que ando buscando.
Necesito alguna forma de ver el contenido de un directorio y permitir que lo descarguen.
En lo posible sin BD!

Gracias igual GastorV!
  #4 (permalink)  
Antiguo 02/07/2009, 16:35
 
Fecha de Ingreso: marzo-2009
Mensajes: 7
Antigüedad: 15 años, 1 mes
Puntos: 0
Respuesta: Download en PHP

Hola nuevamente, e encontrado este codigo:

<?php
// read all php file in the current directory
if ($dh = opendir('./')) {
$files = array();
while (($file = readdir($dh)) !== false) {
if (substr($file, strlen($file) - 4) == '.php') {
array_push($files, $file);
}
}
closedir($dh);
}

// Sort the files and display
sort($files);
echo "<ul>\n";
foreach ($files as $file) {
$title = Title($file);
echo "<li><a href=\"$file\" title=\"$title\">$title</a></li>\n";
}
echo "</ul>\n";

// Function to get a human readable title from the filename
function Title($filename) {
$title = substr($filename, 0, strlen($filename) - 4);
$title = str_replace('-', ' ', $title);
$title = ucwords($title);
return $title;
}
?>

y me anda a la perfeccion cuando lo pongo en un archivo .php pero si quiero que lo muestre en un html como hago?
  #5 (permalink)  
Antiguo 02/07/2009, 16:39
 
Fecha de Ingreso: marzo-2009
Mensajes: 7
Antigüedad: 15 años, 1 mes
Puntos: 0
Respuesta: Download en PHP

Cuando lo pongo dentro del HTML me aparece:

$title\n"; } echo "
\n"; // Function to get a human readable title from the filename function Title($filename) { $title = substr($filename, 0, strlen($filename) - 4); $title = str_replace('-', ' ', $title); $title = ucwords($title); return $title; } ?>

Que es lo que pasa, no tendria que andar, es que recien estoy empesando con PHP.
NO hay alguna forma para llamar al archivo .php que contiene el codigo anterior para no tener que ponerlo en el HTML?
  #6 (permalink)  
Antiguo 02/07/2009, 16:54
 
Fecha de Ingreso: marzo-2009
Mensajes: 7
Antigüedad: 15 años, 1 mes
Puntos: 0
Respuesta: Download en PHP

Este es el codigo que estoy intentando usar, pero no me anda.
Si alguien encuantra algun error o tiene algun consejo se agradece.

<div id="texto1">
<h2>Bienvenido a Virtual Proyect 1.0 !</h2>
<?php
if ($dh = opendir('./')) {
$files = array();
while (($file = readdir($dh)) !== false) {
array_push($files, $file);
}
closedir($dh);
}
sort($files);
echo "<ul>\n";
foreach ($files as $file) {
$title = Title($file);
echo "<li><a href=\"$file\" title=\"$title\">$title</a></li>\n";
}
echo "</ul>\n";
function Title($filename) {
$title = substr($filename, 0, strlen($filename) - 4);
$title = str_replace('-', ' ', $title);
$title = ucwords($title);
return $title;
}
?>
</div>
  #7 (permalink)  
Antiguo 02/07/2009, 18:06
 
Fecha de Ingreso: marzo-2009
Mensajes: 7
Antigüedad: 15 años, 1 mes
Puntos: 0
Respuesta: Download en PHP

Resuelto:

Guarde mi pagina como php y listo.

Gracias por todo.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:03.