Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/09/2013, 02:59
camilomascarell1987
 
Fecha de Ingreso: abril-2013
Mensajes: 39
Antigüedad: 11 años, 1 mes
Puntos: 0
subir imagenes php y mysql por dreamweaver

Bueno dia
Como subir imágenes php y mysql por programas adobe dreamweaver cs5.5
php codigo $_FILES vale?
Código PHP:
<?php require_once('Connections/wordpress.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$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")) {
$tipo_prod $_POST["lstTipo"];

//Guardar imagen
if(is_uploaded_file($_FILES['imagenes']['tmp_name'])) { // verifica haya sido cargado el archivo
$ruta“imagenes/$tipo_prod/.$_FILES['fleImagen']['name'];
move_uploaded_file($_FILES['imagenes']['tmp_name'], $ruta);
}
    
  
$insertSQL sprintf("INSERT INTO wp_productos (nombre, des, precio, referencia, imagenes, imagenes2, imagenes3, imagenes4) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['nombre'], "text"),
                       
GetSQLValueString($_POST['des'], "text"),
                       
GetSQLValueString($_POST['precio'], "double"),
                       
GetSQLValueString($_POST['referencia'], "text"),
                       
GetSQLValueString($_POST['imagenes'], "text"),
                       
GetSQLValueString($_POST['imagenes2'], "text"),
                       
GetSQLValueString($_POST['imagenes3'], "text"),
                       
GetSQLValueString($_POST['imagenes4'], "text"));

  
mysql_select_db($database_wordpress$wordpress);
  
$Result1 mysql_query($insertSQL$wordpress) or die(mysql_error());

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

?>