Foros del Web » Programando para Internet » PHP »

Abrir archivo en carpeta de servidor

Estas en el tema de Abrir archivo en carpeta de servidor en el foro de PHP en Foros del Web. Hola, mi duda es la siguiente: Necesito hacer una página donde poder abrir archivos por ejemplo excel, hice el siguiente código pero no se como ...
  #1 (permalink)  
Antiguo 17/11/2011, 09:33
 
Fecha de Ingreso: mayo-2010
Mensajes: 414
Antigüedad: 13 años, 10 meses
Puntos: 2
Abrir archivo en carpeta de servidor

Hola, mi duda es la siguiente:
Necesito hacer una página donde poder abrir archivos por ejemplo excel, hice el siguiente código pero no se como bajar el archivo subido a la carpeta del servidor.


Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.  
  4.  
  5. <link href="../css/estilos-administrador.css" rel="stylesheet" type="text/css" />
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  7. <meta name="description" content="" />
  8.        
  9.         <meta name="keywords" content="" />                
  10.         <meta name="language" content="spanish" />
  11.         <meta name="distribution" content="global" />
  12.         <meta name="robots" content="all" />
  13. <title>Documento sin t&iacute;tulo</title>
  14.  
  15.  
  16. </head>
  17.  
  18.     <!--start wrapper-->
  19.     <div id="wrapper">
  20.     <!--start header-->
  21.         <div id="header">
  22.          
  23.             <IMG src="../img/logo.png" />
  24.          
  25.         </div>
  26.     <!--end header-->
  27.     <!--start content-->       
  28.             <div id="content">
  29.     <!--start menu-->      
  30.                 <div id="menu">
  31.                    
  32.                     <?php
  33.                    
  34.                         include("../PHP/menu-admin.html");
  35.                    
  36.                     ?>
  37.                    
  38.                 </div>
  39.                
  40.            
  41.                 <div id="caja-derecha">
  42.                         <form name="frmMain" method="post" enctype="multipart/form-data" action="../PHP/proceso-subir-archivo.php">
  43.                        
  44.                            
  45.                             <input type="file" name="archivo" /><br /><br />
  46.  
  47.  
  48.  
  49.                             <input type="submit" class="submit"  class="submit2" value="Enviar archivo" />
  50.                            
  51.                        
  52.  
  53.                                
  54.                        
  55.                         </form>
  56.                     <div>
  57.                        
  58.                
  59.                    
  60.             </div>
  61.     <!--end content-->     
  62.    
  63.    
  64.    
  65.    
  66.     </div>
  67.     <!--end wrapper-->
  68.  
  69. </body>
  70. </html>

Luego hice el php donde se sube el archivo a la carpeta:



Código PHP:
Ver original
  1. <?php
  2.  
  3. $archivo=$_FILES["archivo"]["name"];
  4. $destino="ARCHIVO/$archivo";
  5.  
  6.     if (is_uploaded_file ($_FILES['archivo']['tmp_name']) ){
  7.    
  8.                 move_uploaded_file ($_FILES['archivo']['tmp_name'], "../$destino");
  9.                
  10.    
  11.  
  12.  
  13.             echo "Los datos fueron ingresados
  14.            
  15.            
  16.             <meta http-equiv='refresh' content='2;URL=../PAGINAS/subir-archivos.php'/>";
  17.            
  18.     }      
  19.  
  20.  
  21. ?>


Pero no se el código para bajar el archivo de la carpeta.
  #2 (permalink)  
Antiguo 17/11/2011, 09:37
Avatar de informacionsys  
Fecha de Ingreso: mayo-2011
Ubicación: Bogota D.C
Mensajes: 793
Antigüedad: 12 años, 10 meses
Puntos: 76
Respuesta: Abrir archivo en carpeta de servidor

puedes bajar los archivos de esta manera,

Algo asi:


Código PHP:
Ver original
  1. $files_dir = "directorio_archivos/";
  2. $nom_file = "midocumento.xls";
  3. echo '<a href='.$files_dir.$nom_file'>Descarga archivo</a>';

puede ser una de las muchas alternativas o bueno segun como lo necesites..
  #3 (permalink)  
Antiguo 17/11/2011, 14:21
 
Fecha de Ingreso: mayo-2010
Mensajes: 414
Antigüedad: 13 años, 10 meses
Puntos: 2
Respuesta: Abrir archivo en carpeta de servidor

Gracias !!!!

Etiquetas: html, servidor, carpetas
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 15:55.