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<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="../slider/style/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php if ((isset($_POST["enviado"])) && ($_POST["enviado"] == "form1")) { $nombre_archivo = $_FILES['userfile']['name'];
?>
<script>
opener.document.form1.imagen.value="<?php echo $nombre_archivo; ?>";
self.close();
</script>
<?php
}
else
{?>
<form action="subirimagen.php" method="post" enctype="multipart/form-data" id="form1">
<p>
<input name="userfile" type="file" size="40" />
</p>
<p>
<input type="submit" name="enviado" id="enviado" value="Subir Imagen" />
<input name="enviado" type="hidden" id="enviado" value="form1" />
</p>
</form>
<?php }?>
</body>
</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<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="../slider/style/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script>
function subirimagen()
{
self.name = 'opener';
remote = open('subirimagen.php', 'remote','width=400,height=150,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes,fullscreen=no, status=yes');
remote.focus();
}
</script>
<div id="caja">
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table width="800" border="1" align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Titulo:</td>
<td><input type="text" name="titulo" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Texto:</td>
<td><input type="text" name="texto" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Imagen:</td>
<td><input type="text" name="imagen" value="" size="32" />
<input type="button" name="Subirimagen" id="Subirimagen" value="Subir Imagen" onclick="javascrip:subirimagen();" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input name="buttom" type="submit" id="buttom" value="Insert record" />
<input type="reset" name="borrar" id="borrar" value="Restablecer" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
</div>
</div>
</div>
</body>
</html>
<?php
?>
ayuda por favor gracias