Welcome Guest, Not a member yet? Register   Sign In
Upload function not running
#1

[eluser]überfuzz[/eluser]
I'm building a simple form to mail script. It's supposed to attach a userfile to the mail.
Code:
function index()
    {
        if(isset($_POST['submit']))
        {
            //rules to <form> Setting $this->data['status']) if rules are broken

            $this->data['content'] = "form";
            $this->load->view('templates/standard', $this->data);

            if(!isset($this->data['status']))
            {

                echo "testing upload";   //This one echoes like it should.
                $test = do_upload();  //The print_r() test gives nada.

                print_r($test);


            }
        }
        else
        {

            $this->data['content'] = "form";
            $this->load->view('templates/standard', $this->data);
        }
    }






//function I'm wrestling form input : <?php echo form_upload('userfile', ''); ?>
    function do_upload()
    {
        $config['upload_path'] = './assets/temp/applications/';
        $config['allowed_types'] = 'txt|odt|doc|pdf';
        $config['max_size'] = '100';
        $config['xss_clean'] = TRUE;
        
        $this->load->library('upload', $config);
    
        if ( ! $this->upload->do_upload())
        {
            $error = array('error' => $this->upload->display_errors());
            return $error;   //test
        }    
        else
        {
            $data = array('upload_data' => $this->upload->data());
            return TRUE;   //test
        }
    }

Edit, What am I doing wrong here?


Messages In This Thread
Upload function not running - by El Forum - 11-04-2009, 04:11 AM
Upload function not running - by El Forum - 11-04-2009, 04:26 AM
Upload function not running - by El Forum - 11-04-2009, 04:29 AM
Upload function not running - by El Forum - 11-04-2009, 04:48 AM
Upload function not running - by El Forum - 11-04-2009, 04:50 AM
Upload function not running - by El Forum - 11-04-2009, 05:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB