Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/08/2015, 10:44
sergionuques
 
Fecha de Ingreso: agosto-2015
Ubicación: Guayaquil
Mensajes: 1
Antigüedad: 8 años, 9 meses
Puntos: 0
No funciona el Codigo php y script

Buenas tardes necesito la ayuda de alguien más experimentado que yo por desgracia me falta experiencia para arreglar falla que no me deja terminar mi página web lo que pasa es que el formulario me funciona muy bien lo que no funciona es el php y el script del principio, se supone que este guardaria la imagen que subo en una carpeta que tengo en el servidor, pero no funciona, solo funciona el formulario que perfectamente guarda la dirección en el phpmyadmin junto a los demás datos.

No se si el codigo esta mal ya que lo he revisado muchas veces creo que tal vez es por el hecho de estar trabajando en una mac o no se pienso que tal vez hay una razon aparte por la cual no se lee el codigo.

1)(DOCUMENTO PHP1)
SUBIRIMAGEN.PHP


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>Untitled Document</title>
  6.  
  7. <link href="../slider/style/style.css" rel="stylesheet" type="text/css" />
  8. </head>
  9.  
  10.  
  11.  
  12. <body>
  13.  
  14.  
  15.  
  16. <?php if ((isset($_POST["enviado"])) && ($_POST["enviado"] == "form1")) {
  17.     $nombre_archivo = $_FILES['userfile']['name'];
  18.     move_uploaded_file($_FILES['userfile']['tmp_name'], "imgbanner".$nombre_archivo);
  19. ?>
  20.     <script>
  21.     opener.document.form1.imagen.value="<?php echo $nombre_archivo; ?>";
  22.     self.close();
  23.     </script>
  24. <?php
  25.  
  26.  
  27.  
  28. }
  29. else
  30. {?>
  31. <form action="subirimagen.php" method="post" enctype="multipart/form-data" id="form1">
  32.   <p>
  33.   <input name="userfile" type="file" size="40" />
  34.   </p>
  35.   <p>
  36.     <input type="submit" name="enviado" id="enviado" value="Subir Imagen" />
  37.     <input name="enviado" type="hidden" id="enviado" value="form1" />
  38.   </p>
  39. </form>
  40. <?php }?>
  41. </body>
  42. </html>



1)(DOCUMENTO PHP2 ESTE SI FUNCIONA SOLO LO PONGO PARA QUE VEAN QUE TODO VA BIEN SOLO NO SE GUARDA LA IMAGEN EN LA CARPETA )
INSERTAR.PHP


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>Untitled Document</title>
  6.  
  7. <link href="../slider/style/style.css" rel="stylesheet" type="text/css" />
  8. </head>
  9.  
  10.  
  11.  
  12. <body>
  13.  
  14.  
  15.  
  16. <script>
  17.     function subirimagen()
  18.     {
  19.       self.name = 'opener';
  20.       remote = open('subirimagen.php', 'remote','width=400,height=150,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes,fullscreen=no, status=yes');
  21.       remote.focus();
  22.     }
  23.     </script>
  24.    
  25.    
  26.    
  27.    
  28.    
  29.    
  30.  <div id="caja">
  31.   <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
  32.     <table width="800" border="1" align="center">
  33.       <tr valign="baseline">
  34.         <td nowrap="nowrap" align="right">Titulo:</td>
  35.         <td><input type="text" name="titulo" value="" size="32" /></td>
  36.       </tr>
  37.       <tr valign="baseline">
  38.         <td nowrap="nowrap" align="right">Texto:</td>
  39.         <td><input type="text" name="texto" value="" size="32" /></td>
  40.       </tr>
  41.       <tr valign="baseline">
  42.         <td nowrap="nowrap" align="right">Imagen:</td>
  43.         <td><input type="text" name="imagen" value="" size="32" />
  44.           <input type="button" name="Subirimagen" id="Subirimagen" value="Subir Imagen" onclick="javascrip:subirimagen();" /></td>
  45.       </tr>
  46.       <tr valign="baseline">
  47.         <td nowrap="nowrap" align="right">&nbsp;</td>
  48.         <td><input name="buttom" type="submit" id="buttom" value="Insert record" />
  49.           <input type="reset" name="borrar" id="borrar" value="Restablecer" /></td>
  50.       </tr>
  51.     </table>
  52.     <input type="hidden" name="MM_insert" value="form1" />
  53.   </form>
  54.   <p>&nbsp;</p>
  55. </div>
  56. </div>
  57.  
  58.  
  59.  
  60. </div>
  61. </body>
  62. </html>
  63. <?php
  64. mysql_free_result($Recordset1);
  65. ?>

ayuda por favor gracias

Última edición por Triby; 11/08/2015 a las 17:07 Razón: Código en highlight