Foros del Web » Programando para Internet » PHP »

como le adapto un upload a las imagenes de este codigo php? y donde tengo q adaptarlo

Estas en el tema de como le adapto un upload a las imagenes de este codigo php? y donde tengo q adaptarlo en el foro de PHP en Foros del Web. Código PHP: <?php  require_once( 'Connections/tiendaConn.php' );  ?> <?php function  GetSQLValueString ( $theValue ,  $theType ,  $theDefinedValue  =  "" ,  $theNotDefinedValue  =  "" )  {    ...
  #1 (permalink)  
Antiguo 08/05/2008, 06:53
 
Fecha de Ingreso: abril-2008
Mensajes: 6
Antigüedad: 16 años
Puntos: 0
como le adapto un upload a las imagenes de este codigo php? y donde tengo q adaptarlo

Código PHP:
<?php require_once('Connections/tiendaConn.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 productos (nombre_producto, titulo, categoria, record_label, protagonista, descripcion, formato, entrega, uso, precio, track_list, codigo_pedido, ano, video, imagen) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['nombre_producto'], "text"),
                       
GetSQLValueString($_POST['titulo'], "text"),
                       
GetSQLValueString($_POST['categoria'], "text"),
                       
GetSQLValueString($_POST['record_label'], "text"),
                       
GetSQLValueString($_POST['protagonista'], "text"),
                       
GetSQLValueString($_POST['descripcion'], "text"),
                       
GetSQLValueString($_POST['formato'], "text"),
                       
GetSQLValueString($_POST['entrega'], "int"),
                       
GetSQLValueString($_POST['uso'], "text"),
                       
GetSQLValueString($_POST['precio'], "double"),
                       
GetSQLValueString($_POST['track_list'], "text"),
                       
GetSQLValueString($_POST['codigo_pedido'], "text"),
                       
GetSQLValueString($_POST['ano'], "date"),
                       
GetSQLValueString($_POST['imagen'], "text"),  <---- //miren aqui quisiera convertir estas imagenes en upload
                       
GetSQLValueString($_POST['imagen2'], "text"));  <---- //miren aqui quisiera convertir estas imagenes en upload


  
mysql_select_db($database_tiendaConn$tiendaConn);
  
$Result1 mysql_query($insertSQL$tiendaConn) or die(mysql_error());

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

Última edición por karina17; 08/05/2008 a las 08:04
  #2 (permalink)  
Antiguo 08/05/2008, 08:08
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Re: como le adapto un upload a las imagenes de este codigo php? y donde tengo q adapt

como que ¿como le adapto?

simplemente, inserta el codigo... en alguna parte donde no moleste tu codigo... echo?

PDTA: no creo ke debas meterlo entre el proceso que ahi lleva, solo hazlo despues... o antes
  #3 (permalink)  
Antiguo 08/05/2008, 08:20
 
Fecha de Ingreso: abril-2008
Mensajes: 6
Antigüedad: 16 años
Puntos: 0
Re: como le adapto un upload a las imagenes de este codigo php? y donde tengo q adapt

Cita:
Iniciado por pateketrueke Ver Mensaje
como que ¿como le adapto?

simplemente, inserta el codigo... en alguna parte donde no moleste tu codigo... echo?

PDTA: no creo ke debas meterlo entre el proceso que ahi lleva, solo hazlo despues... o antes

mira en esta parte

Código PHP:
GetSQLValueString($_POST['imagen'], "text"), 
GetSQLValueString($_POST['imagen2'], "text")); 
ahi tengo 2 imagenes q inserto en un listado mediante el nombre.jpg de la foto . lo q quiero es cambiarle esa forma de insertar imagenes a un sistema upload pero no se como hacerlo
  #4 (permalink)  
Antiguo 08/05/2008, 08:27
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Re: como le adapto un upload a las imagenes de este codigo php? y donde tengo q adapt

por lo ke he sabido, debes tener un campo en tu tabla SQL en binario, para almacenar fotos... luego, cambias el <input/> que usas para esos campos, por si tipo... file

una ves subidas las imagenes, lees su informacion binaria y la insertas como si lo hicieras con un text normal... creo
  #5 (permalink)  
Antiguo 08/05/2008, 09:06
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Re: como le adapto un upload a las imagenes de este codigo php? y donde tengo q adapt

Hola Karina17,

Revisa en el foro, hay varios tutoriales de como subir imágenes, inclusive en los Aportes del Foro (primer link en la lista de temas) encontraras códigos para realizarlo.

Saludos.
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 17:36.