Ver Mensaje Individual
  #6 (permalink)  
Antiguo 28/07/2006, 18:24
the_newie
 
Fecha de Ingreso: julio-2006
Ubicación: Buenos Aires-Cap. Fed.
Mensajes: 12
Antigüedad: 17 años, 8 meses
Puntos: 0
<?

if (array_key_exists('_enviado',$_POST))
{

$path=$_SERVER['DOCUMENT_ROOT'].'/' . $nombre . '/';
$path = $path.$_FILES['archivo']['name'];
print 'Se subira el archivo en el directorio '.$path;
if (move_uploaded_file($_FILES['archivo']['tmp_name'],$path)) {echo '<br> Archivo subido';}else{print 'No se subio el archivo, hubo errores';};


} else {
?>


<form name="form1" method="post" action="<?echo $_SERVER['PHP_SELF'];?>" enctype="multipart/form-data">
<table>
<tr>
<td>Nombre:</td><td><input type="text" name="nombre" /></td>
</tr>
<tr>
<td>Archivo:</td><td><input type="hidden" name="MAX_FILE_SIZE" value="2097152" /><input type="file" name="archivo"/></td>
</tr>
<tr>
<td></td><td><input type="submit" value="Subir!"/>
<input type="hidden" name="_enviado"/>
<input type="reset" value="borrar"/></td>
</tr>
</table>
<?
};

?>
</form>



en el campo nombre podes indicar el nombre de la carpeta donde queres que se suba el archivo (esta carpeta tiene que estar creada previamente en el servidor)


si queres que todos los archivos suban a una misma carpeta ya creada tenes que reemplazar esta linea:

$path=$_SERVER['DOCUMENT_ROOT'].'/nombre de la carpeta/';

espero que sea de ayuda.salu2