Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/03/2010, 19:03
vili86
 
Fecha de Ingreso: septiembre-2009
Mensajes: 281
Antigüedad: 14 años, 7 meses
Puntos: 0
Pregunta Una ayuda con Subida de fotos por favor

Hola amigos el problema q tengo es el siguiente.

LLENO UN HISTORIAL Y SUBO SU FOTO TODO ESO ESTA MUY BIEN EL PROBLEMA ES LO SIGUIENTE.

1.- CUANDO NO TENGO UNA FOTO DEL CLIENTE ME MUESTRA UNA FOTO POR DEFECTO ES AQUI MI PROBLEMA CUANDO CARGO DEL CLIENTE SU FOTO ME LO MUESTRA EN LA PRIMERA VEZ PERO CUANDO QUIERO ACTUALIZAR ALGUNOS DATOS PERSONALES DE ESTE CLIENTE MENOS LA FOTO QUE YA TENIA GUARDADA , LO ACTUALIZA PERO CUANDO VUELVO A ENTRAR A SU HISTORIAL AL MOMENTO DE HABER ACTUALIZADO ANTERIORMENTE, ME ACTUALIZO LA FOTO Y ME MUESTRA LA POR DEFECTO CUANDO YA TENIA SU FOTO DEL CLIENTE.

Código PHP:
               $id intval($_POST['hdn_id']);
               
$categoria trim($_POST['categoria']);
        
$nacionalidad trim($_POST['nacionalidad']);
         
$lugar trim($_POST['lugar']);
         
$fecha "$dia/$mes/$ano";
         
$comentario trim($_POST['comentario']);
            

            
//subir imagen
            
            //datos del arhivo 
            
$nombre_archivo $HTTP_POST_FILES["userfile"]["name"]; 
            
$tipo_archivo $HTTP_POST_FILES["userfile"]["type"]; 
            
$tamano_archivo $HTTP_POST_FILES["userfile"]["size"]; 
     if(empty(
$tipo_archivo)){
                         if (empty(
$id)) {
                                            if (
$MOD['jugadores']->setHistorial($comentario,$passwd,$nom_img)){
                                                echo 
"<center> <img src=modulos/imagenes/cargando.gif alt=cargando/></center>";
                                                echo 
"<center>Historial exitoso!. Espere unos instantes</center>";
                                                echo 
"<meta http-equiv=\"refresh\" content=\"3;URL=index.php?mod=jugadores&pag=listado\">\n";
                                            } else {
                                                echo 
"El Historial no fue exitoso";
                                            }
                                      } else {
                                            if (
$MOD['jugadores']->setHistorial($comentario,$passwd,$nom_img,$id)){
                                                echo 
"<center> <img src=modulos/imagenes/cargando.gif alt=cargando/></center>";
                                                echo 
"<center>Historial Guardado exitosamente!. Espere unos instantes</center>";
                                                echo 
"<meta http-equiv=\"refresh\" content=\"3;URL=index.php?mod=jugadores&pag=listado\">\n";
                                            } else {
                                                echo 
"<center>El historial no fue exitosa</center>";
                                            }
                                    }           
     }else{
             
                    if (!((
strpos($tipo_archivo"gif") || strpos($tipo_archivo"jpeg")) && (    $tamano_archivo 100000))){ 
                        echo 
"La extensión o el tamaño de los archivos no es correcta. <br><br><table><tr><td><li>Se permiten archivos .gif o .jpg<br><li>se permiten archivos de             100 Kb máximo.</td></tr></table>";
                        echo 
"<meta http-equiv=\"refresh\" content=\"3;URL=index.php?mod=jugadores&pag=listado\">\n";
            
              
            
                    }else{ 
//no tiene fin
                             
$nom_img$nombre_archivo;
                             
$directorio 'modulos/jugadores/vistas/fotos/';
             
                            if (
move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'],$directorio "/" $nom_img)){ 
                                    if (empty(
$id)) {
                                            if (
$MOD['jugadores']->setHistorial($comentario,$passwd,$nom_img)){
                                                echo 
"<center> <img src=modulos/imagenes/cargando.gif alt=cargando/></center>";
                                                echo 
"<center>Historial exitoso!. Espere unos instantes</center>";
                                                echo 
"<meta http-equiv=\"refresh\" content=\"3;URL=index.php?mod=jugadores&pag=listado\">\n";
                                            } else {
                                                echo 
"El Historial no fue exitoso";
                                            }
                                      } else {
                                            if (
$MOD['jugadores']->setHistorial($comentario,$passwd,$nom_img,$id)){
                                                echo 
"<center> <img src=modulos/imagenes/cargando.gif alt=cargando/></center>";
                                                echo 
"<center>Historial Guardado exitosamente!. Espere unos instantes</center>";
                                                echo 
"<meta http-equiv=\"refresh\" content=\"3;URL=index.php?mod=jugadores&pag=listado\">\n";
                                            } else {
                                                echo 
"<center>El historial no fue exitosa</center>";
                                            }
                                    }
                           }else{
                                 echo 
"error al subir la foto";
                           } 
                    }
     }       
}else{
       echo 
" <center> Usted no tiene permisos </center>";

¿COMO PUEDO EXTRAR DE LA BD EL CAMPO FOTO CARGADO CON EL NOMBRE DE ESA FOTO Y CUANDO ACTUALIZACE LOS DATOS MENOS LA FOTO PUEDA PASAR ESE PARAMETRO Y NO ME MUESTRE LA IMAGEN POR DEFECTO CUANDO YA TENIA SU FOTO DEL CLIENTE ?