Ver Mensaje Individual
  #7 (permalink)  
Antiguo 26/06/2009, 12:22
lauramiracle
 
Fecha de Ingreso: febrero-2009
Mensajes: 77
Antigüedad: 15 años, 3 meses
Puntos: 0
Respuesta: como subir un archivo pdf al servidor?

Encontré la solución...He buscado por internet y he encontrado este codigo, que funciona de verdad!


Código HTML:
<form action="subir2.php" method="post" enctype="multipart/form-data">
<table width="445" height="55" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <input name="archivo" type="file"  id="archivo" size="35" />
    <input name="enviar" type="submit"  id="enviar" value="colgar" />
	<input name="action" type="hidden" value="upload" /> </td>
  </tr>
</table>
</form> 

Espero sirva a alguien...a mi me ha solucionado mucho!



Código PHP:
$status "";
if (
$_POST["action"] == "upload"
{
    
// obtenemos los datos del archivo 
    
$tamano $_FILES["archivo"]['size'];
    
$tipo $_FILES["archivo"]['type'];
    
$archivo $_FILES["archivo"]['name'];
    
    if (
$archivo != ""
    {
        
// guardamos el archivo a la carpeta ficheros
        
$destino =  "boletin/ficheros/".$archivo;
        if (
copy($_FILES['archivo']['tmp_name'],$destino)) 
        {
            
$status "Archivo subido";
        } 
        else 
        {
            
$status "Error al subir el archivo";
        }
    }