<label for="imagen"> descrpcion</label>
<br>
<input type="text" name=" descrpcion" id=" descrpcion">
pero nose como hacer para agregarle eso al codigo ya intente pero no pude espero que me ayuden debe ser algo re facil pero no lo se jaja gracias espero su ayuda
Código PHP:
<?php require_once('Connections/archivo.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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")) {
////////////// Parte añadida 1 //////////////
//array de archivos disponibles
$archivos_disp_ar = array('jpg', 'jpeg', 'gif', 'png');
//carpteta donde vamos a guardar la imagen
$carpeta = 'imagenes/';
//recibimos el campo de imagen
$imagen = $_FILES['imagen']['tmp_name'];
//guardamos el nombre original de la imagen en una variable
$nombrebre_orig = $_FILES['imagen']['name'];
//el proximo codigo es para ver que extension es la imagen
$array_nombre = explode('.',$nombrebre_orig);
$cuenta_arr_nombre = count($array_nombre);
$extension = strtolower($array_nombre[--$cuenta_arr_nombre]);
//validamos la extension
if(!in_array($extension, $archivos_disp_ar)) $error = "Este tipo de archivo no es permitido";
if(empty($error)){
//creamos nuevo nombre para que tenga nombre unico
$nombre_nuevo = time().'_'.rand(0,100).'.'.$extension;
//nombre nuevo con la carpeta
$nombre_nuevo_con_carpeta = $carpeta.$nombre_nuevo;
//por fin movemos el archivo a la carpeta de imagenes
$mover_archivos = move_uploaded_file($imagen , $nombre_nuevo_con_carpeta);
//de damos permisos 777
chmod($nombre_nuevo_con_carpeta,0777);
///////////////////////////////////////////
// se agrega "archivo_archivos, extension_archivos y la fecha" a la consulta y dos extra %s separados por comas
$insertSQL = sprintf("INSERT INTO archivos (tipo_archivos, nombre_archivos, archivo_archivos, extension_archivos, fecha_archivos) VALUES (%s, %s, %s, %s, NOW())",
GetSQLValueString($_POST['tipo'], "text"),
GetSQLValueString($_POST['nombre'], "text"),
////////////// Parte añadida //////////////
GetSQLValueString($nombre_nuevo, "text"),
GetSQLValueString($extension, "text"))
///////////////////////////////////////////
;
mysql_select_db($database_frase, $frase);
$Result1 = mysql_query($insertSQL, $frase) or die(mysql_error());
}
}
mysql_select_db($database_frase, $frase);
$query_Recordset1 = "SELECT * FROM archivos WHERE tipo_archivos = 'general' ORDER BY fecha_archivos DESC";
$Recordset1 = mysql_query($query_Recordset1, $frase) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>