![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
18/04/2008, 13:33
|
![Avatar de boby6killer](http://static.forosdelweb.com/customavatars/avatar230171_1.gif) | | | Fecha de Ingreso: abril-2008
Mensajes: 81
Antigüedad: 16 años, 9 meses Puntos: 1 | |
Re: Plis Ayuda Con Imagrnes En Php Formulario para subir el archivo:
<form action="subearchivo.php" method="post" enctype="multipart/form-data">
<br>
<input name="userfile" type="file">
<input type="submit" value="Enviar">
</form>
Formulario subearchivo.php:
$nombre_archivo = $HTTP_POST_FILES['userfile']['name'];
$tipo_archivo = $HTTP_POST_FILES['userfile']['type'];
if (!((strpos($tipo_archivo, "gif") || strpos($tipo_archivo, "jpg") || strpos($tipo_archivo, "jpeg")|| strpos($tipo_archivo, "bmp")))) {
echo "La extensión o el tamaño de los archivos no es correcta. <br><br><table><tr><td><li>Se permiten archivos gif o jpg<br><li>se permiten archivos de 100 Kb máximo.</td></tr></table>";
}else{
if (move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'], $nombre_archivo)){
echo "El archivo ha sido cargado correctamente.";
}else{
echo "Ocurrió algún error al subir el fichero. No pudo guardarse.";
}
}
Luego lo debes almacenar en la carpeta que tengas definida para las imagenes. |