el script funciona muy bien suben las imagenes a la carpeta y se guardan en la base de datos, pero el problema que tengo es que luego de subida la misma cuando voy a subiendo.php no logro ver las imagenes ya subidas?
si alguien me puede dar una mano muchas gracias!!!!
mi problema es el siguiente tengo este script :
formulario.php
Código PHP:
<?php require_once('Connections/anunciosuy.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$tipo_prod = $_POST["MM_insert"];
//Guardar imagen
if(is_uploaded_file($_FILES['imagen']['tmp_name'])) { // verifica haya sido cargado el archivo
$ruta= "imagenes/".$_FILES['imagen']['name'];
move_uploaded_file($_FILES['imagen']['tmp_name'], $ruta);
}
$insertSQL = sprintf("INSERT INTO formulario (Imagen) VALUES (%s)",
GetSQLValueString($ruta, "text"));
mysql_select_db($database_anunciosuy, $anunciosuy);
$Result1 = mysql_query($insertSQL, $anunciosuy) or die(mysql_error());
$insertGoTo = "/subiendo.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?><style type="text/css">
<!--
#Layer1 {
position:absolute;
left:95px;
top:46px;
width:500px;
height:500px;
z-index:1;
}
-->
</style>
<div id="Layer1">
<form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="form1" id="form1">
<label for="file">Subir Imagen :</label>
<input type="file" name="imagen" id="imagen" />
<label for="Submit"></label>
<p>
<input type="submit" name="Submit" value="Enviar" id="Submit" />
</p>
<p> </p>
<input type="hidden" name="MM_insert" value="form1">
</form>
</div>
Código PHP:
<img src="\imagenes/<?php echo $row_imagenes['imagen']; ?>" width="50" height="50" alt="" />
<?php require_once('Connections/anunciosuy.php'); ?>
<?php
mysql_select_db($database_anunciosuy, $anunciosuy);
$query_imagenes = "SELECT * FROM formulario";
$imagenes = mysql_query($query_imagenes, $anunciosuy) or die(mysql_error());
$row_imagenes = mysql_fetch_assoc($imagenes);
$totalRows_imagenes = mysql_num_rows($imagenes);
mysql_free_result($imagenes);
?>
si alguien me puede dar una mano muchas gracias!!!!
![Afirmando](http://static.forosdelweb.com/fdwtheme/images/smilies/afirmar.gif)
![Afirmando](http://static.forosdelweb.com/fdwtheme/images/smilies/afirmar.gif)
![Afirmando](http://static.forosdelweb.com/fdwtheme/images/smilies/afirmar.gif)
![Afirmando](http://static.forosdelweb.com/fdwtheme/images/smilies/afirmar.gif)