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

(02-13-2016, 11:42 PM)skunkbad Wrote: Maybe something like this:


PHP Code:
/**
 * Array to hold error information about multiple uploads.
 * You can check this later to see what errors there were,
 * and not return FALSE inside the upload method.
 */
public $error_stack = array();

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');

        // Put something in $this->error_stack ...
    

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

        // Put something in $this->error_stack ...
    

    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');

                // Put something in $this->error_stack ...
            }

        }

    }



I need to use the return false. Not sure what I should

PHP Code:
$this->error_stack 
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
RE: Return False Blocking Multiple Messages - by wolfgang1983 - 02-14-2016, 12:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB