Foros del Web » Programando para Internet » PHP »

type file + server behaviors sube el archivo pero no me pone el nombre en la tabla

Estas en el tema de type file + server behaviors sube el archivo pero no me pone el nombre en la tabla en el foro de PHP en Foros del Web. Hola como va, bueno antes k nada gracias por leer mi problema php dw8 tengo un formulario con varios input entre ellos 4 del tipo ...
  #1 (permalink)  
Antiguo 26/07/2007, 16:43
 
Fecha de Ingreso: julio-2007
Mensajes: 8
Antigüedad: 16 años, 9 meses
Puntos: 0
type file + server behaviors sube el archivo pero no me pone el nombre en la tabla

Hola como va, bueno antes k nada gracias por leer mi problema php dw8
tengo un formulario con varios input entre ellos 4 del tipo "file" y 1 del tipo hidden, a este formulario le aplique el behaviors insert record; el archivo propiamente dicho ej una imagen la sube perfectamente a la carpeta k corresponde, todos los campos suben a la tabla menos los del tipo file y hidden, es decir que en la tabla me los pone "NULL", por ende cuando los quiero mostrar en algun resultado no puedo ya que no me inserto el nombre de estos archivos. cual es el fucking problema? mil gracias!!!!
  #2 (permalink)  
Antiguo 26/07/2007, 22:09
Avatar de geq
geq
 
Fecha de Ingreso: agosto-2006
Ubicación: Rosario
Mensajes: 655
Antigüedad: 17 años, 8 meses
Puntos: 22
Re: type file + server behaviors sube el archivo pero no me pone el nombre en la tab

Si publicas tu código tal vez podamos ayudarte ^^

Exitos.
  #3 (permalink)  
Antiguo 27/07/2007, 07:36
 
Fecha de Ingreso: julio-2007
Mensajes: 8
Antigüedad: 16 años, 9 meses
Puntos: 0
Re: type file + server behaviors sube el archivo pero no me pone el nombre en la tab

es verdad, ahi va parte del codigo gracias!!


Código 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")) {
  
$insertSQL sprintf("INSERT INTO inmueble (tipo_propiedad_id_tipo_propiedad, estado_id_estado, partido_id_partido, img_principal, img_uno, img_dos, img_tres, fecha, info, entre, direccion, mostrar, localidad, ambientes, plantas, antiguedad, estado_de_propiedad, orientacion, sup_terreno, frente, fondo, sup_cubierta, sup_libre, gas, telefono, cloaca, calefaccion, expensas, dormitorio_uno, dormitorio_dos, dormitorio_tres, dormitorio_cuatro, dormitorio_cinco, dep_servicio, living, comedor, cocina, com_diario, escritorio, playroom, cochera_tipo, banios, toilette, lavadero, balcon, terraza, quincho, picina, observaciones, precio) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['tipo_propiedad_id'], "int"),
                       
GetSQLValueString($_POST['estado_id_estado'], "int"),
                       
GetSQLValueString($_POST['partido_id_partido'], "int"),
                       
GetSQLValueString($_POST['img_principal'], "text"),
                       
GetSQLValueString($_POST['img_uno'], "text"),
                       
GetSQLValueString($_POST['img_dos'], "text"),
                       
GetSQLValueString($_POST['img_tres'], "text"),
                       
GetSQLValueString($_POST['fecha'], "date"),
                       
GetSQLValueString($_POST['info'], "text"),
                       
GetSQLValueString($_POST['entre'], "text"),
                       
GetSQLValueString($_POST['direccion'], "text"),
                       
GetSQLValueString($_POST['mostrar'], "int"),
                       
GetSQLValueString($_POST['localidad'], "text"),
                       
GetSQLValueString($_POST['ambientes'], "text"),
                       
GetSQLValueString($_POST['plantas'], "text"),
                       
GetSQLValueString($_POST['antiguedad'], "text"),
                       
GetSQLValueString($_POST['estadodeinmueble'], "text"),
                       
GetSQLValueString($_POST['orientacion'], "text"),
                       
GetSQLValueString($_POST['sup_terreno'], "text"),
                       
GetSQLValueString($_POST['frente'], "text"),
                       
GetSQLValueString($_POST['fondo'], "text"),
                       
GetSQLValueString($_POST['sup_cubierta'], "text"),
                       
GetSQLValueString($_POST['sup_libre'], "text"),
                       
GetSQLValueString($_POST['gas'], "text"),
                       
GetSQLValueString($_POST['telefono'], "text"),
                       
GetSQLValueString($_POST['cloaca'], "text"),
                       
GetSQLValueString($_POST['calefaccion'], "text"),
                       
GetSQLValueString($_POST['expensas'], "text"),
                       
GetSQLValueString($_POST['dormitorio_uno'], "text"),
                       
GetSQLValueString($_POST['dormitorio_dos'], "text"),
                       
GetSQLValueString($_POST['dormitorio_tres'], "text"),
                       
GetSQLValueString($_POST['dormitorio_cuatro'], "text"),
                       
GetSQLValueString($_POST['dormitorio_cinco'], "text"),
                       
GetSQLValueString($_POST['dep_servicio'], "text"),
                       
GetSQLValueString($_POST['living'], "text"),
                       
GetSQLValueString($_POST['comedor'], "text"),
                       
GetSQLValueString($_POST['cocina'], "text"),
                       
GetSQLValueString($_POST['com_diario'], "text"),
                       
GetSQLValueString($_POST['escritorio'], "text"),
                       
GetSQLValueString($_POST['playroom'], "text"),
                       
GetSQLValueString($_POST['cochera'], "text"),
                       
GetSQLValueString($_POST['banios'], "text"),
                       
GetSQLValueString($_POST['toilette'], "text"),
                       
GetSQLValueString($_POST['lavadero'], "text"),
                       
GetSQLValueString($_POST['balcon'], "text"),
                       
GetSQLValueString($_POST['terraza'], "text"),
                       
GetSQLValueString($_POST['quincho'], "text"),
                       
GetSQLValueString($_POST['picina'], "text"),
                       
GetSQLValueString($_POST['observaciones'], "text"),
                       
GetSQLValueString($_POST['precio'], "int"));

  
mysql_select_db($database_cnx$cnx);
  
$Result1 mysql_query($insertSQL$cnx) or die(mysql_error());

  
$insertGoTo "aviso_de_alta.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}

$colname_rsdetallealquiler "-1";
if (isset(
$_GET['id_inmueble'])) {
  
$colname_rsdetallealquiler = (get_magic_quotes_gpc()) ? $_GET['id_inmueble'] : addslashes($_GET['id_inmueble']);
}
mysql_select_db($database_cnx$cnx);
$query_rsdetallealquiler sprintf("SELECT * FROM inmueble WHERE id_inmueble = %s"$colname_rsdetallealquiler);
$rsdetallealquiler mysql_query($query_rsdetallealquiler$cnx) or die(mysql_error());
$row_rsdetallealquiler mysql_fetch_assoc($rsdetallealquiler);
$totalRows_rsdetallealquiler mysql_num_rows($rsdetallealquiler);

mysql_select_db($database_cnx$cnx);
$query_rspartido "SELECT * FROM partido";
$rspartido mysql_query($query_rspartido$cnx) or die(mysql_error());
$row_rspartido mysql_fetch_assoc($rspartido);
$totalRows_rspartido mysql_num_rows($rspartido);

mysql_select_db($database_cnx$cnx);
$query_rstipopropiedad "SELECT * FROM tipo_propiedad";
$rstipopropiedad mysql_query($query_rstipopropiedad$cnx) or die(mysql_error());
$row_rstipopropiedad mysql_fetch_assoc($rstipopropiedad);
$totalRows_rstipopropiedad mysql_num_rows($rstipopropiedad);

mysql_select_db($database_cnx$cnx);
$query_rsestado "SELECT * FROM estado";
$rsestado mysql_query($query_rsestado$cnx) or die(mysql_error());
$row_rsestado mysql_fetch_assoc($rsestado);
$totalRows_rsestado mysql_num_rows($rsestado);

?><!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">
<head>
</head>

<body>

<?php

        
// Subir fichero
      
$copiarFichero false;

   
// Copiar fichero en directorio de ficheros subidos
   // Se renombra para evitar que sobreescriba un fichero existente
   // Para garantizar la unicidad del nombre se añade una marca de tiempo
      
if (is_uploaded_file ($_FILES['img_principal']['tmp_name']))
      {
         
$nombreDirectorio "fotos/";
         
$nombreFichero $_FILES['img_principal']['name'];
         
$copiarFichero true;

      
// Si ya existe un fichero con el mismo nombre, renombrarlo
         
$nombreCompleto $nombreDirectorio $nombreFichero;
         if (
is_file($nombreCompleto))
         {
            
$idUnico time();
            
$nombreFichero $idUnico "-" $nombreFichero;
         } 
   
// El fichero introducido no se ha podido subir
      
else
      {
         
$errores["img_principal"] = "¡No se ha podido subir el archivo!";
         
$error true;
      }
   }
   if (
$copiarFichero)
         
move_uploaded_file ($_FILES['img_principal']['tmp_name'],
         
$nombreDirectorio $nombreFichero);
        
?>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:09.