Foros del Web » Programando para Internet » PHP »

Subir Imágenes a la BD con Dreamweaver??

Estas en el tema de Subir Imágenes a la BD con Dreamweaver?? en el foro de PHP en Foros del Web. puedo hacer el formulario de registro con Dreamweaver pero necesito adaptarle y/o modificarle algo de codigo PHP/MySQL para hacer que coloque una imagen en una ...
  #1 (permalink)  
Antiguo 26/04/2005, 00:35
 
Fecha de Ingreso: febrero-2003
Mensajes: 15
Antigüedad: 21 años, 2 meses
Puntos: 1
Exclamación Subir Imágenes a la BD con Dreamweaver??

puedo hacer el formulario de registro con Dreamweaver pero necesito adaptarle y/o modificarle algo de codigo PHP/MySQL para hacer que coloque una imagen en una carpeta y guarde la URL en la BD

Como puedo hacer eso?

Quiero es adaptar dicho codigo!

llevo más de una semana seguida y nada, si alguien le puede dedicar un tiempito se los agradezco, es que estoy full presionado!

Este es el codigo completo que intento adaptar...
Código PHP:
<?php
 
//INICIO DEL DOLOR DE CABEZA -------------------------------------------------------------------------
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"] == "enviar")) {
  
$insertSQL sprintf("INSERT INTO prueba01 (id_prueba1, dato_prueba1, imagen1) VALUES (%s, %s, %s)",
                       
GetSQLValueString($_POST['id_prueba1'], "int"),
                       
GetSQLValueString($_POST['dato_prueba1'], "text"),
                       
GetSQLValueString($_POST['form_imagen1'], "text"));

  
mysql_select_db($database_gcd$gcd);
  
$Result1 mysql_query($insertSQL$gcd) or die(mysql_error());
}
// FIN DEL DOLOR DE CABEZA ---------------------------------------------------------------------------
//                                 Como Adapto este formulario para que suba imágenes??



 // (INICIO) CONSULTA DE MAXIMOS IDS----------------------------------------------------------------------
mysql_select_db($database_gcd$gcd);
$query_maximos1y2 "SELECT max(id_prueba1), max(id_prueba2) FROM prueba01, prueba02";
$maximos1y2 mysql_query($query_maximos1y2$gcd) or die(mysql_error());
$row_maximos1y2 mysql_fetch_assoc($maximos1y2);
$totalRows_maximos1y2 mysql_num_rows($maximos1y2);

mysql_select_db($database_gcd$gcd);
$query_img "SELECT id_prueba1, imagen1 FROM prueba01 WHERE id_prueba1=3";
$img mysql_query($query_img$gcd) or die(mysql_error());
$row_img mysql_fetch_assoc($img);
$totalRows_img mysql_num_rows($img);
// (FIN) CONSULTA DE MAXIMOS IDS --------------------------------------------------------------------------?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form action="<?php echo $editFormAction?>" method="POST" enctype="multipart/form-data" name="enviar" id="enviar"POST>
  <p>Dato en tabla01 
    <input name="dato_prueba1" type="text" id="dato_prueba1" size="10" maxlength="10">
    <input name="id_prueba1" type="hidden" id="id_prueba1" value="<?php echo $row_maximos1y2['max(id_prueba1)']; ?>">
  </p>
  <p>Dato en tabla02 
    <input name="dato_prueba2" type="text" id="dato_prueba2" size="10" maxlength="10">
    <input name="id_prueba2" type="hidden" id="id_prueba2" value="<?php echo $row_maximos1y2['max(id_prueba2)']; ?>">
</p>
  <p>Imagen:
    <input name="form_imagen1" type="file" id="form_imagen12">
  </p>
  <p><img src="<?php echo $row_img['imagen1']; ?>"></p>
  <p> </p>
  <p>
    <input name="Submit_enviar" type="submit" id="Submit_enviar" value="Enviar">
</p>
  <input type="hidden" name="MM_insert" value="enviar">
</form>
</body>
</html>
<?php
mysql_free_result
($maximos1y2);

mysql_free_result($img);
?>
Este codigo funciona bien, guarda la información de los campos en su respectiva tabla pero falta el campo Imagen1

P.D. no me manden a leer las decenas de articulos porque ya los he visto y los comprendo por lo menos en un 80% pero aún así no puedo adaptarlos al Dreamweaver 2004

  #2 (permalink)  
Antiguo 26/04/2005, 01:04
Avatar de jam1138
/** @package Moderador */
 
Fecha de Ingreso: julio-2004
Ubicación: sèveR led onieR lE
Mensajes: 9.368
Antigüedad: 19 años, 8 meses
Puntos: 102
Cita:
Iniciado por EFranz
(...) P.D. no me manden a leer las decenas de articulos porque ya los he visto (...)
Al menos se te puede pedir que te concentres en tus mensajes originales??...
http://www.forosdelweb.com/f18/serios-problemas-para-guardar-ruta-imagen-trabajo-con-dreamwaver-2004-a-291779/#post1067511

...no repitas consultas ... para tu beneficio, para beneficio del foro... para beneficio de todos. Gracias.
__________________
٩(͡๏̯͡๏)۶
» Cómo hacer preguntas de manera inteligente «

"100 años después, la revolución no es con armas, es intelectual y digital"
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.
Tema Cerrado




La zona horaria es GMT -6. Ahora son las 08:12.