Código:
contiene un formulario, con un campo file llamado name="foto_equipo[]" para subir ua imagen del equipo.<table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr><td><img src="../imagenes/img_07.gif" width="124" height="47" border="0"></td></tr> </table> <? espacios("100%",2,"","../"); espacios("99%",1,"#CCCCCC","../");?> <table border="0" cellpadding="0" cellspacing="0" width="99%"> <tr> <td width="1" bgcolor="#CCCCCC"><img src="../imagenes/clear_pixel.gif" width="1" height="1" border="0"></td> <form name="form1" method="post" action="004.php" onSubmit="return validarRegistro(this);" enctype="multipart/form-data"> <input type="Hidden" name="accion" value="1"> <input type="Hidden" name="urlDestino" value="003.php"> <td bgcolor="#F5F5F5" valign="top" align="center"><!-- inicio listado del contenido y las secciones--> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td bgcolor="#80B5D7"><img src="../imagenes/clear_pixel.gif" width="1" height="3" border="0"></td></tr> <tr><td bgcolor="#3872B2"><img src="../imagenes/clear_pixel.gif" width="1" height="18" border="0"></td></tr> </table> <? espacios("100%",12,"","../");?> <table border="0" cellpadding="0" cellspacing="0" width="97%"> <tr> <td valign="top"><!--form noticias--> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td width="80" class="texto2">país</td> <td><select name="id_pais"> <option value="">selecciona uno</option> <option value="">- - - - - - - - - - - - - - - - - - - - - -</option> <? $total = count($array_pais); for($x = 1; $x < $total; $x++){?> <option value="<?=$array_pais[$x]["id"];?>"><?=$array_pais[$x]["name"];?></option> <? }?> </select></td> </tr> </table> <? espacios("100%",15,"","../");?> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td width="80" class="texto2">descripción</td> <td></td> </tr> <tr><td colspan="2"><? espacios("100%",5,"","../");?></td></tr> <tr><td colspan="2"><textarea name="descripcion" cols="82" rows="7" onKeyDown="textCounter(document.form1.descripcion,document.form1.counter3,400)" onKeyUp="textCounter(document.form1.descripcion,document.form1.counter3,400)" class="text"></textarea></td></tr> <tr><td colspan="2"><input type="text" readonly="yes" name="counter3" size="3" maxlength="3" value="400" class="counter"> carácteres restantes.</td></tr> </table> <? espacios("100%",15,"","../");?> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td width="80" class="texto2">coach</td> <td><input type="text" name="coach" size="67" maxlength="40" class="formText"></td> </tr> </table> <? espacios("100%",15,"","../");?> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td width="80" class="texto2">t. assistant</td> <td><input type="text" name="assistant" size="67" maxlength="40" class="formText"></td> </tr> </table> <? espacios("100%",15,"","../");?> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td width="80" class="texto2">h. delegation</td> <td><input type="text" name="delegation" size="67" maxlength="40" class="formText"></td> </tr> </table> <? espacios("100%",15,"","../");?> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td width="80" class="texto2">captain</td> <td><input type="text" name="captain" size="67" maxlength="40" class="formText"></td> </tr> </table> <? espacios("100%",15,"","../");?> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td width="80" class="texto2">doctor</td> <td><input type="text" name="doctor" size="67" maxlength="40" class="formText"></td> </tr> </table> <? espacios("100%",15,"","../");?> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td width="80" class="texto2">uniform 1</td> <td><input type="text" name="uniform1" size="67" maxlength="40" class="formText"></td> </tr> </table> <? espacios("100%",15,"","../");?> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td width="80" class="texto2">uniform 2</td> <td><input type="text" name="uniform2" size="67" maxlength="40" class="formText"></td> </tr> </table> </td><!--fin form noticias--> <td width="1" bgcolor="#666666"><img src="../imagenes/clear_pixel.gif" width="1" height="1" border="0"></td> <td width="9"> </td> <td width="375" valign="top"><!--inicio extras--> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td width="80" class="texto2">foto equipo</td> <td><input type="file" name="foto_equipo[]" size="35" class="formText"></td> </tr> </table> </td><!--fin extras--> </tr> </table> <? espacios("100%",25,"","../");?> <table border="0" cellpadding="0" cellspacing="0" width="97%"> <tr><td><input type="submit" name="botonS" value="Insertar equipo" class="button"></td></tr> </table>
pero cuando en el php donde inserto en la base de datos hago esto...
Código:
me imprime que "no hay foto del equipo" y yo en el form le he metido una imagen para q subirla!!!if(array_key_exists("foto_equipo", $_POST)){ echo('hay foto del equipo<br>'); $img_equipo = true; $num_img_equipo = count($_POST["foto_equipo"]); }else{ echo('no hay foto del equipo<br>'); }
mesta volviendo loco!
thanks