Ver Mensaje Individual
  #6 (permalink)  
Antiguo 22/03/2013, 08:52
gusanosxr
 
Fecha de Ingreso: junio-2012
Ubicación: Santiago de Chile
Mensajes: 164
Antigüedad: 12 años, 9 meses
Puntos: 1
Respuesta: problema con input file

Cita:
Iniciado por loncho_rojas Ver Mensaje
en ese caso existe

$_FILES["archivo"] y no $_POST o GET["archivos"]
compa le pego todo el archivo para que mires que asi no me funciona

Código PHP:


<?
session_start
();
if (
$_SESSION['numuser']==""){
header("Location:index.html");
}
?>
<!DOCTYPE HTML>
<head>    
    <title>Menú Principal</title>
       <style type="text/css">
table {
  border-collapse: collapse;
  border: 0px solid #4F81BD;
  font: normal 11px verdana, arial, helvetica, sans-serif;
  color: #000000;
  background: #FFFFFF;
  }
.boton {
    border: 0px solid;
    background-image:url('imagenes/edita.jpg'); 
    width:110px; 
    height:35px;     
}  
td, th {
  border: 0px solid #4F81BD;
  padding: .5em;
  color: #000000;
  }
.odd {
  background: #DBE5F1;
  }
</style>
<script type="text/javascript">
function guardar(objeto){    
if (document.form1.categoria.value==''){
          alert("Debe ingresar categoria")
        form1.categoria.focus()
       return false
    }
if (document.form1.archivo.value==''){
          alert("Debe asociar imagen")
        form1.archivo.focus()
       return false
    }
}
</script>
</head>

<div STYLE="position:absolute; top:0px; left:140px;">
<body onload = "document.form1.categoria.focus()">
<table border="0" width="600">
<tr>
<td><img src="imagenes/logo.jpg" width="300" height="150" /></td>
<td> 
  <img src="imagenes/principio2.jpg" width="611" height="41" /></td>
</tr>
</table>
</div>
<div STYLE="position:absolute; top:200px; left:140px;">
<body onload = "document.form1.nombre.focus()">
<table border="0" width="400" height="300">
<tr>
<td><a href="administrador.php"><img src="imagenes/botonadmin.jpg" width="134" height="31" /></a></td>
</tr>
<tr>
<td><a href="acceso-restringido.php"><img src="imagenes/botonaccesos.jpg" width="134" height="31" /></a></td>
</tr>
<tr>
<td><a href="categorias.php"><img src="imagenes/botoncategoria.jpg" width="134" height="31" /></a></td>
</tr>
<tr>
<td><a href="productos.php"><img src="imagenes/botonproductos.jpg" width="134" height="31" /></a></td>
</tr>
<tr>
<td><a href="index.html"><img src="imagenes/botonweb.jpg" width="134" height="31" /></a></td>
</tr>
<tr>
<td><a href="logout.php"><img src="imagenes/botoncierra.jpg" width="134" height="31" /></a></td>
</tr>
</table>

</div>

<div STYLE="position:absolute; top:0px; left:140px;">
<table border="0" width="600">
<tr>
<td><img src="imagenes/logo.jpg" width="300" height="150" /></td>
<td> 
  <img src="imagenes/principio2.jpg" width="611" height="41" /></td>
</tr>
</table>
</div>
<?php
include "conectar.php";
$result mysql_query("SELECT * FROM categorias WHERE categoriaID=".$_GET["var"]);
if (
mysql_num_rows($result)>0){
   
$nommysql_result($result0"nombre");
   
$imgmysql_result($result0"imagen");         
   }
?>
<form name="form1" method="POST" action="guarda-edita-categoria.php" enctype="multipart/form-data" onsubmit="return guardar(this)">
<div style="position:absolute; top:200px; left:440px;">
<table border="0" width="600" height="100">
<input type="hidden" name="IDcat" value="<?=$_GET["var"];?>" />
<tr>
<td><FONT FACE="arial" SIZE=2 COLOR=Black>Categoria</FONT> </td><td> <input type="text" name="categoria" value="<?=$nom;?>" size="30"></input></td>
</tr>
<tr>
<td><FONT FACE="arial" SIZE=2 COLOR=Black>Imagen (200px X 200px)</FONT> </td><td> <input type="file" name="archivo" id="archivo" /></input>
</tr>
<tr>
<td><FONT FACE="arial" SIZE=2 COLOR=Black>Imagen actual</FONT>
<?echo
(
"<td><a href=ver-imagen.php?var=".mysql_result($result$i"categoriaID")." target=popup onclick=window.open(this.ref, this.target)>
<image src=images/"
.mysql_result($result,$i,"imagen")." width=40 heigth=30 title=Ver-Imagen></a></td>");
?></td>
</tr>
<tr>
<td></td><td><input type="submit" value="" class="boton"></input></td>
</tr>
</table>
</div>
</form>
<div STYLE="position:absolute; top:370px; left:440px;">
<table border="0" width="600" height="100">
<tr>
<td></td>
<td><img src="imagenes/principio4.jpg" width="611" height="31" /></td>
</tr>
</table>
<?php

echo("<table border=1 width=600>");
echo(
"<tr>");
      echo(
"  <td>Nombre</td>");
      echo(
"  <td>Imagen</td>");
      echo(
"  <td>Editar</td>");
      echo(
"  <td>Eliminar</td>");            
      echo(
"</tr>");
include 
"conectar.php";
$consulta "SELECT * FROM categorias WHERE vigente='S'";
$result mysql_query($consulta);
if (@
mysql_num_rows($result)>0){
   
$i=0;
   
$rows=mysql_num_rows($result);
   while(
$i $rows) {
    echo(
"<tr>");
    echo(
"<td>".mysql_result($result$i"nombre")."</td>");   
    echo(
"<td><image src=images/".mysql_result($result$i"imagen")." width=35 heigth=35></td>");    
    echo(
"<td><a href=edita-categoria.php?var=".mysql_result($result$i"categoriaID")."><image src=imagenes/lapiz.gif width=20 heigth=20 title=Editar></a></td>");
     echo(
"<td><a href=elimina-categoria.php?var=".mysql_result($result$i"categoriaID")."><image src=imagenes/eliminar.gif width=20 heigth=20 title=Eliminar></a></td>");     
    echo(
"</tr>");
   
$i++;
   }
}
?>
</table>
</div>
</body>
</html>