Welcome Guest, Not a member yet? Register   Sign In
ok, i know that i have maybe 48 hours working, but now is not working :(
#1

[eluser]Asinox[/eluser]
ok guys, jejeje, im developing 3 website, yes im overload , im tired, im lost, im not here!!, but im trying now to fix a bug,s in a editing function, the problem is that i have a lot of function like this... but i saw all my functions, and my problem is that i want to upload a file or not, if the user try to upload is fine, or if the user dont want to upload a file is fine too... now im testing and dont work in any case:

Code:
function editar__articulo(){ //function para actualizar articulo
    
    if($this->form_validation->run('articulo') == FALSE){ // VALIDACION DE CAMPOS VACIOS
    
    $data['titulo'] = "Bienvenido al panel de administracion";
        $data['main_admin'] = "dashboard/editar_articulo";
        $data['categorias'] = $this->modcategorias->listar_categorias();
        $data['articulo'] = $this->modarticulos->_editar($this->input->post('id'));
        $this->load->vars($data);
        $this->load->view('dashboard/main_admin');
        
    }else{
        
        if(!empty($_FILES['userfile']['tmp_name'])){
            
            echo "[removed]alert('with file');[removed]";
            
        }else{
            
            echo "[removed]alert('without file');[removed]";
            
        }
        
        
    } // VALIDACION DE CAMPOS VACIOS
}


this if is wrong of my way to validate the if file is sending is wrong?

Thanks u
#2

[eluser]Fero[/eluser]
Rewrite that post.. non-understandable english, dude..
#3

[eluser]vitoco[/eluser]
Creo que te puedo responder en español , asi que comienzo preguntando porque ejecutas run() en el if dentro de la función y no tienes las reglas dentro de la funcion...donde estan las reglas de validacion??

lo segundo es un caso de prueba , en cual de las dos opciones entra?? cual es el problema exacto ?? que condicion no entrega el resultado esperado ?

Code:
function editar__articulo(){ //function para actualizar articulo
    
    if($this->form_validation->run('articulo') == FALSE){ // <-- PORKE AKI ???
    
    $data['titulo'] = "Bienvenido al panel de administracion";
        $data['main_admin'] = "dashboard/editar_articulo";
        $data['categorias'] = $this->modcategorias->listar_categorias();
        $data['articulo'] = $this->modarticulos->_editar($this->input->post('id'));
        $this->load->vars($data);
        $this->load->view('dashboard/main_admin');
        
    }else{
        
        if(!empty($_FILES['userfile']['tmp_name'])){
            
            echo "[removed]alert('with file');[removed]";
            
        }else{
            
            echo "[removed]alert('without file');[removed]";
            
        }
        
        
    } // VALIDACION DE CAMPOS VACIOS
}
#4

[eluser]Asinox[/eluser]
[quote author="Fero" date="1237350728"]Rewrite that post.. non-understandable english, dude..[/quote]

ejjee ejej thanks, im trying!! jejeje
#5

[eluser]Asinox[/eluser]
Hola vitoco, pues la regla de validacion esta en el directorio Config donde tengo un archivo para validar todos mis formularios, eso funciona a la perfeccion.

El problema es que si envio un archivo... igual se va al else, si no envio un archivo tambien pasa al else... nunca esta pasando antes del else, pero te juro, que tengo varias funciones iguales que si funcionan, pero no se que esta pasando, talvez este yo cansado y doy mas, pero por Dios que tengo horas rehaciendo la funcion.

Saludos
#6

[eluser]vitoco[/eluser]
Si puedes postea las reglas de validacion. Para hacer algunas pruebas con el tema .

Saludos




Theme © iAndrew 2016 - Forum software by © MyBB