Foros del Web » Programando para Internet » PHP »

Guardar nombre varios archivos en phpmyadmin

Estas en el tema de Guardar nombre varios archivos en phpmyadmin en el foro de PHP en Foros del Web. Hola, les cuento; tengo un formulario donde se ingresan artículos y cada registro va con una foto que se inserta por medio de un input; ...
  #1 (permalink)  
Antiguo 21/09/2015, 08:15
Avatar de marynella  
Fecha de Ingreso: septiembre-2015
Ubicación: Bogota
Mensajes: 57
Antigüedad: 8 años, 7 meses
Puntos: 1
Guardar nombre varios archivos en phpmyadmin

Hola, les cuento; tengo un formulario donde se ingresan artículos y cada registro va con una foto que se inserta por medio de un input; mi problema es que cuanto trato de guardar el nombre de los archivos en la base de datos phpmyadmin solo toma el ultimo nombre .... Como hago para que los guarde todos ??
  #2 (permalink)  
Antiguo 21/09/2015, 09:15
Avatar de bymorr  
Fecha de Ingreso: septiembre-2012
Mensajes: 118
Antigüedad: 11 años, 7 meses
Puntos: 9
Respuesta: Guardar nombre varios archivos en phpmyadmin

Muestra parte del código.
Para ver como extraes los campos y como los envías a guardar. si es 1 por 1 o en un arreglo.
  #3 (permalink)  
Antiguo 21/09/2015, 13:51
Avatar de marynella  
Fecha de Ingreso: septiembre-2015
Ubicación: Bogota
Mensajes: 57
Antigüedad: 8 años, 7 meses
Puntos: 1
Respuesta: Guardar nombre varios archivos en phpmyadmin

Mira mi codigo:
Código PHP:
Ver original
  1. <?php
  2.         $conta = 'SELECT MAX(num_ingreso) AS num_ingreso FROM registro_ingreso';
  3.             $bus = $conexion->query($conta);
  4.  
  5.             if ($bus->num_rows > 0){
  6.                 $fila = $bus->fetch_array();
  7.                     $n = 1 + $fila["num_ingreso"];
  8.             }
  9.        
  10.         if(isset($_POST['registro'])){ 
  11.             if ($result = $conexion->query("INSERT INTO registro_ingreso (num_ingreso ,fecha_ingreso ,nombre, herramienta_ingresada, imagen ,empresa, salida_herramienta ,herramienta_retirada)
  12.                     VALUES ('$n','{$_POST['fecha']}','{$_POST['nombre']}','{$_POST['ingreso']}','{$_POST['fotos']}','{$_POST['empresa']}','{$_POST['salida']}','{$_POST['retiro']}')"))
  13.                 {
  14.                     echo'<script>
  15.                         alert("Registro Exitoso");
  16.                         window.location.href="../index.php";
  17.                     </script>';
  18.                 }else{
  19.                     echo'<script>
  20.  
  21.                         alert("Registro No Guardado");
  22.                         window.location.href="formato.php";
  23.  
  24.                     </script>';
  25.                 }
  26.         }
  27.  
  28.        
  29.     ?>

Código HTML:
Ver original
  1. <form name="formulario" id="formulario" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">                                                                                                
  2.             <div align="center"><table id="tabla" width="97%" border="0"><br>          
  3.             <tr>
  4.                     <td width="160" style="border: 2px solid #016495;"><center><font color="white" size="3"/><b>N° Ingreso</b></td>
  5.                     <td width="100" style="border: 2px solid #016495;"><center><font color="white" size="3"/><b>Fecha Ingreso</b></td>
  6.                 <td width="160" style="border: 2px solid #016495;"><center><font color="white" size="3"/><b>Nombre</b></td>
  7.                 <td width="160" style="border: 2px solid #016495;"><center><font color="white" size="3"/><b>Herramienta Ingresada</b></td>             
  8.                 <td width="160" style="border: 2px solid #016495;"><center><font color="white" size="3"/><b>Empresa</b></td>
  9.                     <td width="150" style="border: 2px solid #016495;"><center><font color="white" size="3"/><b>Fecha Salida de Herramientas</b></td>
  10.                 <td width="150" style="border: 2px solid #016495;"><center><font color="white" size="3"/><b>Herramienta Retirada</b></td>              
  11.                 </tr>
  12.             <tr bgcolor="#ffffff">
  13.                 <td><center><input type="text" size="3" value="<?php echo $n;?>" style="border:none; text-align:center; background-color:#ffffff" readonly/></center></td>
  14.                 <td><center><input type="date" name="fecha" style="border:none; background-color:#ffffff; text-align:center" required/></td>
  15.                 <td><textarea cols="22" rows="3" maxlength="30" style="border:none; background-color:#ffffff" name="nombre"  required></textarea></td>
  16.                 <td><textarea cols="22" rows="3" maxlength="30" style="border:none; background-color:#ffffff" name="ingreso" required></textarea></td>
  17.                 <td><textarea cols="22" rows="3" maxlength="30" style="border:none; background-color:#ffffff" name="empresa" required></textarea></td>             
  18.                 <td><input type="date" name="salida" size="16" style="border:none; background-color:#ffffff; text-align:center" required/></td>
  19.                 <td><textarea cols="22" rows="3" maxlength="30" style="border:none; background-color:#ffffff" name="retiro" required></textarea></td>
  20.             </tr>      
  21.         </table></div>
  22.         <div align="center"><table id="archivos" width="97%" border="0">
  23.             <tr>
  24.                 <td width="15%"><font color="white" size="3"/><b>Adjuntar imagen:</b></td>
  25.                 <td bgcolor="#ffffff"><input type="file" name="fotos" style="background-color:#ffffff" required/><td>
  26.                 </tr>
  27.         </table>
  28.        
  29.     </form>

Etiquetas: formulario, nombre, phpmyadmin, registro
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:17.