Welcome Guest, Not a member yet? Register   Sign In
Return False Blocking Multiple Messages
#1

On my upload function I have a if in_array in my multiple upload. And sets multiple error messages.

My problem now if I put return FALSE; It will stop the multiple messages from showing and only set one message.

How can I solve this? Any ideas with examples thank you.


PHP Code:
public function upload($field 'userfile') {

 
   $allowed_extension explode('|'$this->allowed_types);

 
   if (empty($this->upload_path)) {
 
       $this->set_error('upload_path_not_set''upload_path_check');
 
        return FALSE;
 
   

 
   if (!realpath(FCPATH $this->upload_path)) {
 
       $this->set_error('upload_path_in_correct''location_check');
 
       return FALSE;
 
   

 
   if (!empty($this->files[$field]['name'][0])) {

 
       foreach ($this->files[$field]['name'] as $key => $value) {

 
           $this->file_name $this->files[$field]['name'][$key];

 
           $get_file_extension explode('.'$this->files[$field]['name'][$key]);
 
           $this->get_file_extension_end strtolower(end($get_file_extension));
 
               
            $array_1 
= array(
 
               $allowed_extension,
 
           );

 
           $array_2 = array(
 
               $get_file_extension[1],
 
           );
 
               
            if 
(!in_array($array_2$array_1)) {
 
                   
                $this
->set_error('file_extension_not_allowed''extension_check');

 
               return FALSE;
 
           }

 
       }

 
   }


There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
Return False Blocking Multiple Messages - by wolfgang1983 - 02-13-2016, 11:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB