JAJAJ LOGRE QUE QUE EL NOMBRE DE LA IMAGEN SE VEA POR USUARIO EN LA BASE DE DATOS.
OSEA SI FERNANDO SUBE UNA IMAGEN LE APAREZCA SOLO A EL JAJJAA AHORA TENGO OTRO PROBLEMITA QUE ANTES NO TENIA, NO PUEDO HACER QUE SE GUARDE LA IMAGEN EN LA CARPETA Y SI LOGRO QUE LA IMAGEN SE VEA NO ME APARECE EN LA BASE DE DATOS¨?
LES DEJO EL SCRIPT PARA VER SI ALGUNO SE DA CUENTA Y ME PUEDE AYUDAR
Código PHP:
Ver original<p> </p>
<?php require_once('Connections/hoysale.php'); ?>
<?php
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_update"])) && ($_POST["MM_update"] == "form1")) { //Guardar imagen
if(is_uploaded_file($_FILES['Imagen']['tmp_name'])) { // verifica haya sido cargado el archivo $ruta= "imagenes/".$_FILES['Imagen']['name'];
}
$updateSQL = sprintf("UPDATE registrarse SET imagen=%s WHERE id_user=%s", GetSQLValueString($ruta, "text"),
GetSQLValueString($_POST['id_user'], "int"));
$updateGoTo = "subio.php";
if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ?
"&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING'];
}
}
$colname_Recordset1 = "-1";
if (isset($_SESSION['MM_id_user'])) { $colname_Recordset1 = $_SESSION['MM_id_user'];
}
$query_Recordset1 = sprintf("SELECT * FROM registrarse WHERE id_user = %s", GetSQLValueString
($colname_Recordset1, "int"));
?>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Imagen:</td>
<td><input type="file" name="imagen" value="
<?php echo htmlentities($row_Recordset1['imagen'], ENT_COMPAT, ''); ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Actualizar registro"></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="id_user" value="<?php echo $row_Recordset1['id_user']; ?>">
</form>