Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/06/2011, 00:50
ZebaA
 
Fecha de Ingreso: junio-2011
Mensajes: 26
Antigüedad: 13 años, 9 meses
Puntos: 0
guardar imagenes con formulario

hola otra vez....

mi problema que tengo es que tengo un formulario y en el formulario tengo un archivo para fotos....

registro_vehiculo.php...

Código PHP:
Ver original
  1. <table align="center" border="1" width="90%" bgcolor="#CCCCCC">
  2. <form method="post" name="formulario" action="insertar.php">
  3.         <tr>
  4.           <td width="105"><strong class="Estilo1">Vehiculo Nuevo</strong></td>
  5. <td width="171">&nbsp;<select name="nuevo">Seleccione Una Opcion...
  6.                                     <option value="no">NO</option>
  7.                                     <option value="si">SI</option>
  8.           </select></td>
  9.            <td width="105"><strong class="Estilo1">Tipo Vehiculo(*)</strong></td>
  10.           <td width="171">&nbsp;<?php include ('tipo_vehiculo.php');?></td>
  11.         </tr>
  12.         <tr>
  13.             <td width="105"><strong class="Estilo1">Carroceria(*)</strong></td>
  14.           <td width="171"><div id="resultado"></div></td>
  15.            
  16.             <td width="105"><strong class="Estilo1">Marca(*)</strong></td>
  17.           <td width="171">&nbsp;<input type="text" name="marca" /></td>
  18.         </tr>
  19.         <tr>
  20.             <td width="105"><strong class="Estilo1">Modelo(*)</strong></td>
  21.           <td width="171">&nbsp;<input type="text" name="modelo" /></td>
  22.            
  23.             <td width="105"><strong class="Estilo1">Año(*)</strong></td>
  24.           <td width="171">&nbsp;<input type="text" name="ano" size="8" /></td>
  25.         </tr>
  26.          <tr>
  27.             <td width="105"><strong class="Estilo1">Patente(*)</strong></td>
  28.            <td width="171">&nbsp;<input type="text" name="patente" size="8" maxlength="6" onBlur="this.value = RvalPat(this.value)"/></td>
  29.            
  30.             <td width="105"><strong class="Estilo1">Precio(*)</strong></td>
  31.            <td width="171">&nbsp;<input type="text" name="pesos" maxlength="11" onBlur="this.value=retInt(this.value)"/></td>
  32.         </tr>
  33.         <tr>
  34.             <td width="105"><strong class="Estilo1">Otro</strong></td>
  35.             <td width="171" align="center"><textarea name="otro" rows=4 cols=40 ></TEXTAREA></FONT></td>
  36.             <td width="105"><strong class="Estilo1">Radio</strong></td>
  37.             <td width="171" align="center"><input type="checkbox" name="radio" /></td>
  38.     </tr>
  39.         <tr>
  40.             <td width="105"><strong class="Estilo1">Imagen</strong></td>
  41.             <td width="171">&nbsp;<input type="file" name="imagen " /></td>
  42.             <td width="105"><strong class="Estilo1">Alarma</strong></td>
  43.             <td width="171" align="center"><input type="checkbox" name="alarma"/></td>            
  44.         </tr>
  45.         <tr>
  46.             <td></td>
  47.             <td><input type="submit" value="Enviar" onclick="valida()"></td>
  48.         </tr>
  49.   </form>
  50. </table>

necesito ingresar los datos del fomulario .... me ingresan los datos ... pero no se como ingresar la imagen a mysql

no se si crear un tabla nueva para la foto o no...

mi base de datos es esta...

Código MySQL:
Ver original
  1. CREATE TABLE `datos_auto` (
  2.   `id` int(11) NOT NULL auto_increment,
  3.   `nuevo` varchar(10) NOT NULL,
  4.   `carroceria` varchar(100) NOT NULL,
  5.   `modelo` varchar(100) NOT NULL,
  6.   `ano` int(11) NOT NULL,
  7.   `patente` varchar(100) NOT NULL,
  8.   `tipo_vehi` varchar(100) NOT NULL,
  9.   `marca` varchar(100) NOT NULL,
  10.   `precio` int(20) NOT NULL,
  11.   `otro` varchar(1000) NOT NULL,
  12.   `imagen` blob NOT NULL,
  13.   `radio` varchar(10) NOT NULL,
  14.   `alarma` varchar(10) NOT NULL,
  15.   PRIMARY KEY  (`id`)
  16. ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

muchas gracias