EllisLab text mark
Advanced Search
     
You did not select a file to upload.
Posted: 06 October 2012 02:17 PM   [ Ignore ]
Joined: 2012-06-04
15 posts

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:

$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 ?

 
Posted: 06 October 2012 07:31 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2009-04-15
453 posts

put your image upload code inside a

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){... })

 Signature 

Code By Jeff

Mahana Messaging Library

Problem with your query? Did you run

$this->db->last_query(); 

before you came to the forums for help?

 
Posted: 07 October 2012 12:50 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2012-06-04
15 posts

i will try this, ty so much!