hola mira yo tengo este codigo si suben las fotos pero no eh logrado ver las fotos, pero quizas te ayude.
formulario.php
Código PHP:
Ver original<?php require_once('Connections/anunciosuy.php'); ?>
<?php
$colname_imagen = "-1";
if (isset($_GET['fleImagen'])) { }
$query_imagen = sprintf("SELECT Titulo, Imagen FROM formulario WHERE Imagen = '%s'", $colname_imagen);
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
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["Submit"];
//Guardar imagen
if(is_uploaded_file($_FILES['fleImagen']['tmp_name'])) { // verifica haya sido cargado el archivo $ruta= "imagenes/".$_FILES['fleImagen']['name'];
}
$insertSQL = sprintf("INSERT INTO formulario (Titulo, Imagen) VALUES (%s, %s)", GetSQLValueString($_POST['txttitulo'], "text"),
GetSQLValueString($ruta, "text"));
$insertGoTo = "subiendo.php";
if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ?
"&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING'];
}
}
?><style type="text/css">
<!--
#Layer1 {
position:absolute;
left:84px;
top:61px;
width:61px;
height:81px;
z-index:1;
}
-->
</style>
<div id="Layer1">
<form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="form1" id="form1">
<label for="textfield">Titulo :</label>
<input type="text" name="txttitulo" id="txttitulo" />
<label for="file">Imagen :</label>
<input type="file" name="fleImagen" id="fleImagen" />
<label for="Submit"></label>
<input type="submit" name="Submit" value="Enviar" id="Submit" />
<input type="hidden" name="MM_insert" value="form1">
</form>
</div>
<p>
<?php
?>
</p>
<p><img name="" src="<?php echo $row_imagen['Imagen']; ?>" alt="" /> </p>
ingreso_exitoso.php
Código HTML:
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"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
ingreso existoso
subiendo.php
Código PHP:
Ver original<ul>
<img src="/imagenes/<?php echo $row_imagen['imagen']; ?>"/>
<ul/>
<?php require_once('Connections/anunciosuy.php'); ?>
<?php
$query_imagen = "SELECT Imagen FROM formulario ORDER BY Imagen ASC";
?>
es a modo de referencia tu le pones los datos que quieras, pero asi sube a la carpeta y se guarda en la base de datos, lo unico que yo aun no eh logrado poder verla..