Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/02/2012, 18:42
Avatar de andresdzphp
andresdzphp
Colaborador
 
Fecha de Ingreso: julio-2011
Ubicación: $this->Colombia;
Mensajes: 2.749
Antigüedad: 12 años, 9 meses
Puntos: 793
Respuesta: campo file detectar si esta lleno...

Un condicional comprobando si hubo error o no...

Supongamos que tienes un formulario así:

Código HTML:
Ver original
  1. <form action="prueba.php" method="post" enctype="multipart/form-data">
  2.   Enviar estos ficheros:<br />
  3.   <input name="imagenes[]" type="file" /><br />
  4.   <input name="imagenes[]" type="file" /><br />
  5.   <input type="submit" value="Enviar ficheros" />
  6. </form>

Código PHP:
Ver original
  1. <?php
  2. $total_imgs = count($_FILES['imagenes']['name']);
  3.  
  4. for ($i = 0; $i < $total_imgs; $i++) {
  5.     if ($_FILES['imagenes']['error'][$i] > 0) {
  6.         echo 'error <br />';
  7.     } else {
  8.         echo 'sin error <br />';
  9.     }
  10. }
__________________
Si sabemos como leer e interpretar el manual será mucho más fácil aprender PHP. En lugar de confiar en ejemplos o copiar y pegar - PHP