Ver Mensaje Individual
  #6 (permalink)  
Antiguo 14/07/2008, 11:08
Avatar de T4ke0veR
T4ke0veR
 
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: No se puede mostrar la web en UPLOAD

a ver si hago la cosa mas facil
mi base de datos

tabla productos
`id` int(11) NOT NULL auto_increment,
`id_cat` int(11) NOT NULL,
`titulo` text NOT NULL,
`descripcion` text NOT NULL,
`metraje` text NOT NULL,
`pecio` text NOT NULL,
`imgprinc` text NOT NULL,
`logo` text NOT NULL,
PRIMARY KEY (`id`)

y ahora mi codigo como esta ahora en este momento
Código PHP:
<?php require_once ('conect.php');
@
$id=$_REQUEST['id'];

            
$sqlt="SELECT * FROM productos WHERE id=$id";
            
$sql_exect=mysql_query($sqlt);
            while(
$rowt=mysql_fetch_assoc($sql_exect)){
                
$pic2 $rowt['logo'];
            }

// Carpeta donde se subiran los archivos
$dir 'logo';
$direct "../logo";
// Puedes poner otra mas "larga" pero sin '/' al final
// Peso máximo del archivo. SE COLOCA EN BYTES
$mpeso 500000;
// Extensión permitida del archivo.
$extf "jpg";
//------------------------------
        
extract($_POST);
        
//print_r($_POST);
            
if (isset($_POST['enviar'])) {
            
$_FILES['archivo']['name'] = str_replace(' '''$_FILES['archivo']['name']);            
            
$name=$_FILES['archivo']['name'];
            
                if (
substr($_FILES['archivo']['name'],-3,3) == $extf) {
                    if (
$_FILES['archivo']['size'] <= $mpeso) {
                        if (
move_uploaded_file($_FILES['archivo']['tmp_name'], $dir.'/alt-'.$id.'-'.$_FILES['archivo']['name'])) {
                            
$status "1";
                        }
                    } else { 
$status "2"; }
                }
        
// El codigo de imagenes se maneja "ID - Nombre de imagen".

            
$status=1;
            
$desti=$dir.'/alt-'.$id.'-'.$name;
            
            
            
$query "UPDATE productos SET
            pic2 = '$desti' WHERE id=$id"
;
            
            
mysql_query($query);
        
            
header("Location: ing_logo.php?id=$id");
            exit();    
            }
            

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Panel Administrativo</title>
<script language="javascript" type="text/javascript">
function validar_archivo(archivo) {
    var error_archivo;
    error_archivo=0;
      var file=archivo.value;
      
          if (file=="")
          { error_archivo=1; }
          //texto += "\n\nIngrese Foto"
            else{
             
                 // file=document.formulario.FOTO.value
               extArray = new Array(".gif",".jpg",".swf");
               // Extension de archivos permitidos
               allowSubmit = false;
                 if (!file) return;

                   while (file.indexOf("\\") != -1)
                       file = file.slice(file.indexOf("\\") + 1);
                       ext = file.slice(file.indexOf(".")).toLowerCase();
                   
                   for (var i=0; i < extArray.length; i++){
                          if (extArray[i] == ext){
                             allowSubmit = true;
                             break;
                            }
                    }

                        if (!allowSubmit) {
                         error_archivo=2;
                        // texto += "\n\nFOTO: solo admite archivo con la extensión ''gif, .jpeg , .jpg''";
                         }
                            }
                            return error_archivo;
}



</script>

<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
-->
</style></head>

<body>
<table width="372" border="0" align="center" cellpadding="0" cellspacing="3">
  <tr>
    <td width="366"><img src="header_admin.jpg" width="500" height="150" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="center">&nbsp;
      <table width="0" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="461"><form action="<?php echo $_SERVER['PHP_SELF'?>" method="post" enctype="multipart/form-data">
              <p>
                <input name="id" type="hidden" id="x" value="<?php echo $id?>" />
              </p>
            <table width="376" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="116" class="azul_verd_nrm">Agregar Foto </td>
                  <td width="260"><input type="file" name="logo" class="enviainput" /></td>
                </tr>
              </table>
            <p align="center">
                <label>
                <input name="enviar" type="submit" id="enviar" value="enviar" />
                </label>
              </p>
          </form><?php echo $sqlt="SELECT * FROM productos WHERE id=$id";
?></td>
        </tr>
      </table>
    <p>&nbsp;</p></td>
  </tr>
  <tr>
    <td><?php echo $rowt['logo'?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
ahora no da errores pero como veran tngo un echo al campo logo el cual no se esta imprimiendo y deberia imprimirse asi como se imprime el id....
y al momento de hacer enviar no esta actualizando en la base de datos
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...