Ver Mensaje Individual
  #2 (permalink)  
Antiguo 11/01/2012, 12:27
oliverarthurnardi
 
Fecha de Ingreso: noviembre-2010
Ubicación: aun no se donde vivir
Mensajes: 112
Antigüedad: 13 años, 6 meses
Puntos: 3
Respuesta: No entiendo por que me da este error.

Cita:
Iniciado por oliverarthurnardi Ver Mensaje
( ! ) Notice: Undefined index: tpm_name in C:\wamp\www\evatienda\admin\imagenproducto.php on line 13
Call Stack
# Time Memory Function Location
1 0.0032 370480 {main}( ) ..\imagenproducto.php:0

Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Subir Imagen</title>
  6. </head>
  7.  
  8.  
  9. <body>
  10. <?php
  11. if ((isset($_POST["enviado"])) && ($_POST["enviado"] == "form1")) {
  12.   $nombre_archivo = $_FILES['userfile']['name'];
  13.   move_uploaded_file($_FILES['userfile']['tpm_name'],"../imagenes/productos/".$nombre_archivo);  
  14.  
  15.   ?>
  16.   <script type="text/javascript">
  17.     oponer.document.form1.photo.value="<?php echo $_FILES['userfile']['name']; ?>";
  18.     self.close();
  19.   </script>
  20.   <?php
  21. }
  22. else
  23. {
  24.    
  25. ?>
  26. <form action="imagenproducto.php" method="post" enctype="multipart/form-data" id="form1">
  27.  
  28.   <p>
  29.     <input name="userfile" type="file" />
  30.   </p>
  31.   <p><input type="submit" name="button" id="button" value="Subir Imagen"/> </p>
  32.   <p><input type="hidden" name="enviado" value="form1"/></p>
  33. </form>
  34. <?php } ?>
  35. </body>
  36. </html>
Hice un print_r( $_FILES) para ver si la variable 'tpm_name' existe y el resultado
que obtengo es
Array ( [userfile] => Array ( [name] => ejemplo.jpg [type] => image/jpeg [tmp_name] => C:\wamp\tmp\php289.tmp [error] => 0 [size] => 201572 ) )


Eso significa que la variable 'tpm_name' existe si no me equivoco.