esta es la tabla de la db tantis:
CREATE TABLE fotolog (
id_fotolog int(10) NOT NULL auto_increment,
user_f varchar(255) NOT NULL default '',
categoria varchar(255) NOT NULL default '',
ruta varchar(255) NOT NULL default '',
comentario varchar(255) NOT NULL default '',
fecha date NOT NULL default '0000-00-00',
archivo varchar(255) NOT NULL default '',
PRIMARY KEY (id_fotolog)
) TYPE=MyISAM;
este es el formulario
Código HTML:
<form action="<?=$PHP_SELF?>" method="post" enctype="multipart/form-data" name="form1"> <table width="95%" border="0"> <tr> <td colspan="2"> </td> </tr> <tr> <td width="51%">autor: <?php echo $_SESSION['MM_Username']?> </td> <td width="49%">titulo/categoria <input name="categoria" type="text" id="categoria"></td> </tr> <tr> <td colspan="2"><span class="FORMULARIOS">Archivo</span> <input name="archivo_" type="file" class="campos" id="archivo_"> <input name="archivo" type="text" id="archivo"></td> </tr> <tr> <td colspan="2">Comentario de la foto: <input name="comentario" type="text" id="comentario"></td> </tr> <tr> <td colspan="2"><input name="boton" type="submit" id="boton" value="Enviar"> <input name="fecha" type="hidden" id="fecha" value="<? echo date("y"),"/",date("m"),"/",date("d")?>"> <input name="user" type="hidden" id="user2" value="<?php echo $_SESSION['MM_Username']?> "> <input type="hidden" name="hiddenField" value="<?php echo FORM.archivo?>"><? echo $HTTP_POST_FILES['archivo']['tmp_name']?></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1">
CODIGO PHP
Código PHP:
<?php require_once('../Connections/conex_tan.php'); ?>
<?
if($boton) {
if (is_uploaded_file($HTTP_POST_FILES['archivo']['tmp_name'])) {
copy($HTTP_POST_FILES['archivo']['tmp_name'], $HTTP_POST_FILES['archivo']['name']);
$subio = true;
// }
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']);
}
?>
<?php
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO fotolog (user_f, categoria, ruta, comentario, fecha) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['user'], "text"),
GetSQLValueString($_POST['categoria'], "text"),
GetSQLValueString($_POST['archivo'], "text"),
GetSQLValueString($_POST['comentario'], "text"),
GetSQLValueString($_POST['fecha'], "date"));
mysql_select_db($database_conex_tan, $conex_tan);
$Result1 = mysql_query($insertSQL, $conex_tan) or die(mysql_error());
$insertGoTo = "cargar_nuevo_fotolog.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_conex_tan, $conex_tan);
$query_fotolog = "SELECT * FROM fotolog";
$fotolog = mysql_query($query_fotolog, $conex_tan) or die(mysql_error());
$row_fotolog = mysql_fetch_assoc($fotolog);
$totalRows_fotolog = mysql_num_rows($fotolog);
?>
<?
}
////
if($subio) {
echo "El archivo subio con exito";
} else {
echo "El archivo no cumple con las reglas establecidas";
}
die();
}
?>
Por otro lado, en la galeria de imagenes se listarian de la siguiente forma. Tengo dos iframes(lista y cuerpo), en uno, el listado de todas las categorias, donde con clickear, te carga la categoria en el iframe cuerpo, mostrando la foto y el comentario. 1er error: Hay algun script que genere automaticamente las thumbnails? Por que sino las veo todas desproporcionadas? dos:
Espero no molestar mucho con esto. Agradecere alguna pista de como hacerlo ya que es mi debut con este codigo. Saludos y muchas gracias nuevamente