Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/11/2018, 09:49
santa2r
 
Fecha de Ingreso: diciembre-2008
Mensajes: 122
Antigüedad: 15 años, 5 meses
Puntos: 1
Pregunta Problema con imagen de formulario

tengo problemas al intentar subir imagen al servidor, pongo el codigo use el var_dumppara ver que me tira tambien.
Código PHP:
<?php
if(isset($_POST["enviar"])){
     
var_dump($_FILES); // y esto me tira array(0) { } 
    
echo $_FILES["foto"]["name"];// esto me sale vacio
    
require("admin/conectar.php");
    include(
'admin/SimpleImage.php');
    
$sql=mysqli_query($conn "SELECT * FROM blog ORDER BY `id` ASC ");
    if(
$_POST["titulo"]=="" and $_POST["mensaje"]==""){
        
$b=2;
    }
    else{
        
$b=1;
        while(
$rsmysqli_fetch_array($sql)){
        
$i $rs["id"] + 1;
        }
        
//foto
        
if($_FILES["foto"]["name"]==""){
        
$imagena="";
        
$thumb ="";
        echo 
"aaaaaaaaaaaa"//Siempre muestra aca por estar vacio claro
        
}
        else{
            echo 
"estoy aca";
        
$ext strrchr($HTTP_POST_FILES["foto"]["name"],'.');    
        
$id_foto "A".$i;  
        
$id_foto_db="blogimg/".$id_foto."".$ext;
        
$id_foto_thumb="blogimg/thumb/".$id_foto."".$ext;
        
move_uploaded_file($_FILES["foto"]["tmp_name"],"blogimg/".$id_foto_db."".$ext);
        
move_uploaded_file($_FILES["foto"]["tmp_name"],"blogimg/thumb".$id_foto_thumb."".$ext);
        
$imagena $id_foto_db;
        
$thumb $id_foto_thumb;
           
$image = new SimpleImage();
          
$image->load($id_foto_thumb);
         
$image->resize(148,142);
          
$image->save($id_foto_thumb);
        }
        
$hoy date("Y-m-d H:i:s");
      
mysqli_query($conn "insert into blog (titulo,fecha,noticia,foto,thumb) values ('".$_POST['titulo']."','".$hoy."','".$_POST['mensaje']."','".$imagena."','".$thumb."')");
    }
}
?>