Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/05/2011, 21:10
Antonioj1015
 
Fecha de Ingreso: agosto-2009
Mensajes: 30
Antigüedad: 14 años, 7 meses
Puntos: 0
Pregunta Problema con campos "file"

Tengo dos formularios:
Código HTML:
<form action="productos/agregar.php" method="post" enctype="multipart/form-data" name="fagregarprod" id="fagregarprod" >
<table width="450" border="0" align="center">
<tr>
<td width="193" align="right" valign="top">Referencia:</td>
<td width="197" align="left">
<input name="refprodagr" type="text" id="refprodagr" size="25" maxlength="13" />
</td>
</tr>
<tr>
<td align="right" valign="top">Nombre del Producto:</td>
<td align="left">
<input name="nomprodagr" type="text" id="nomprodagr" size="25" maxlength="7" />
</td>
</tr>
<tr>
<td height="24" align="right" valign="top">Imagen:</td>
<td align="left">
<input type="file" name="agrprod" id="agrprod" /></td>
</tr>
<tr>
<td height="46" align="right"><input type="submit" value="Enviar" /></td>
<td align="left"><input type="reset" value="Limpiar" /></td>
</tr>
</table><br />
</form> 
y el otro
Código HTML:
<form name="fmodificarprod" id="fmodificarprod" method="post" action="productos/modificar.php">
<table width="450" border="0" align="center">
<tr>
<td width="101" align="right">Referencia:</td>
<td width="189" align="left">
<select name="refprodmod">
<?php
$stid=oci_parse($conn, "SELECT * FROM PRODUCTO");
oci_execute($stid);
$norows=oci_fetch_all($stid,$results);
for ($i=0; $i<$norows; $i++)
{
echo '<option value=' . $results["REFERENCIA"][$i] . '>' . $results["REFERENCIA"][$i] . '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td align="right" valign="top">Nombre del Producto:</td>
<td align="left">
<input name="nomprodmod" type="text" id="nomprodmod" size="25" maxlength="7" />
</td>
</tr>
<tr>
<td height="24" align="right" valign="top">Imagen:</td>
<td align="left">
<input type="file" name="modprod" id="modprod" /></td>
</tr>
<tr>
 <td height="46" align="right"><input type="submit" value="Enviar" /></td>
<td align="left"><input type="reset" value="Limpiar" /></td>
</tr>
</table>
</form> 
Como pueden ver tengo dos campos "FILE" en dos form aparte (agrprod y modprod), el problema es q el primero me funciona bien pero el segundo cuando envio no me lo reconoce...
aqui dejo el modificar.php
Código PHP:
$path="../../img/"
$nombre=$_FILES['modprod']['name']; 
$tipo=explode("."$nombre);
if (
$tipo[1] != "jpg" && $tipo[1] != "jpeg" && $tipo[1] != "png" && $tipo[1] != "gif")
{
if (
is_uploaded_file($_FILES['img']['tmp_name'][$i]))

copy($_FILES['img']['tmp_name'][$i], "$path/$nombre");

oci_free_statement($stid);
$stid=oci_parse($conn"INSERT INTO PRODUCTO VALUES(...campos... '$path/$nombre')");
oci_execute($stid);
header("Location: ../admin.php?menu=productos&resultado=agregado");
exit;

tal cual tengo el de agregar pero con el nombre de "agrprod" y ese si me funciona...He intentado colocarle img[] y llamar el segundo con $_FILES['modprod']['name'][1] y nada...
GRACIAS