• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
You did not select a file to upload.

#1
[eluser]Yakow[/eluser]
Hi. When i try to do a form without a imagem, i recive this message: "You did not select a file to upload."

My controller:

Code:
$this->load->helper('conversor_de_formatos');
        $this->load->library('form_validation');
        $this->load->helper('date');
        
        $user = $this->ion_auth->user()->row();

        $config['upload_path'] = 'imagem_upload';
        $config['allowed_types'] = 'jpg';
        $config['max_size'] = 3000;
        $config['max_width'] = 1000;
        $config['max_height'] = 1000;
        $config['encrypt_name'] = TRUE;

        $this->load->library('upload', $config);
        
        if (!$this->upload->do_upload('userfile')) {
            echo $this->upload->display_errors();
        } else {

            $arquivo_enviado = $this->upload->data();
            
            $data['userfile'] = $arquivo_enviado['file_name'];
...


anyone can help me ?

#2
[eluser]jmadsen[/eluser]
put your image upload code inside a

Code:
if ($_FILES){... }

condition. This way it will only fire if you are actually uploading a file. (You may want to put that part inside a if ($_POST){... })

#3
[eluser]Yakow[/eluser]
i will try this, ty so much!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.