Welcome Guest, Not a member yet? Register   Sign In
upload file validation
#1

hi
can anyone add upload file validation in CI3
Reply
#2

(01-26-2015, 04:14 AM)fakhrawy Wrote: hi
can anyone add upload file validation in CI3

PHP Code:
public function upload_attachment() {
//validation start
        
$config['upload_path'] = './uploads';
        
$config['allowed_types'] = 'jpg|png|gif';
         
$config['max_width']            = 1024;
        
$config['max_height']           = 768;
        
$config['max_size'] = 1000;
//validation end 

        
$this->load->library('upload'$config);

        if (!
$this->upload->do_upload('attachment')) {
            echo 
'Erorr :' $this->upload->display_errors();
        } else {
            
$attachment $this->upload->data();
           echo 
$attachment['file_name'];
        }
    } 
The largest Bengali tutorial site on Web Development in this planet
Reply




Theme © iAndrew 2016 - Forum software by © MyBB