Welcome Guest, Not a member yet? Register   Sign In
Upload has issue with some files "You did not select a file to upload"
#11

[eluser]johansonevR[/eluser]
i have the same problem here , none of the above mentioned solves my problem.
This is my controller. Every time i try to upload a file an error message "You did not select a file to upload" is output. I've tryed this code
Code:
$config['upload_path'] = './images/uploads/';
                $config['allowed_types'] = 'gif|jpg|png';
                $config['max_size']    = '10000';
                $this->load->library('upload', $config);
                $this->upload->do_upload('image');
[/code]
in a test page and it worked.
Code:
<?php
class NewAdv extends Controller{
    function NewAdv(){
        parent::Controller();
        $this->load->model('newAdv_model');
        
    }
    function index(){
        $rules=array(
                   ...
                );
        $this->form_validation->set_rules($rules);
            if($this->form_validation->run()==FALSE){
                $city['city']=$this->session->userdata('city');
                    $this->load->view('newAdv_view',$city);
                
                
                }else{
                    if($this->input->post('expires')==7){
                        $exp=date('Y-m-d', mktime(0, 0, 0, date("m")  , date("d")+7, date("Y")));
                        }elseif($this->input->post('expires')==14){
                        $exp=date('Y-m-d', mktime(0, 0, 0, date("m")  , date("d")+14, date("Y")));
                        }
                        //This part here does not work
                $config['upload_path'] = './images/uploads/';
                $config['allowed_types'] = 'gif|jpg|png';
                $config['max_size']    = '10000';
                $this->load->library('upload', $config);
                $this->upload->do_upload('image');
                echo $this->upload->display_errors(); // for debuging
                        $today=date("Y-m-d");
                    $data=array(
                    'title'=>$this->input->post('title'),
                    'adv_body'=>$this->input->post('adv_body'),
                    'price'=>$this->input->post('price'),
                    'currency'=>$this->input->post('currency'),
                    'city'=>$this->session->userdata('city'),
                    'category'=>$this->input->post('category'),
                    'created_by'=>$this->session->userdata('username'),
                    'expires'=>$exp,
                    'created'=>$today
                                );
                    $this->newAdv_model->insert($data);
                        sleep(1);
                        redirect('adv/view/'.mysql_insert_id(),'refresh');
                }                    
    }

}
?>


Messages In This Thread
Upload has issue with some files "You did not select a file to upload" - by El Forum - 04-05-2010, 09:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB