public function store($dest_folder, Callable $modifyName = null) {
        if (!isset($_FILES[$this->_file])) {
            return false;
        }
        
        if (is_array($_FILES[$this->_file]['name'])) {
            // Multiple file uploads
            $count = count($_FILES[$this->_file]['name']);
            $stored = [];
            $fails = [];
            
            for ($i = 0; $i < $count; $i++) {
                // Get modified name from callback
                $dest = rtrim($dest_folder, '/') . '/' . 
                    (is_callable($modifyName) ? $modifyName($_FILES[$this->_file]['name'][$i]) : $_FILES[$this->_file]['name'][$i]);
                
                if (File::rename($_FILES[$this->_file]['tmp_name'][$i], $dest)) {
                    // Record all uploaded files
                    $stored[] = $_FILES[$this->_file]['name'][$i];
                } else {
                    $fails[] = $_FILES[$this->_file]['name'][$i];
                }
            }
            
            return [
                    'stored' => $stored,
                    'failed' => $fails
                ];
        }
        
        // Single file upload
        $dest = rtrim($dest_folder, '/') . '/' . 
            (is_callable($modifyName) ? $modifyName($_FILES[$this->_file]['name']) : $_FILES[$this->_file]['name']);
        
        return File::rename($_FILES[$this->_file]['tmp_name'], $dest);
    }
public function store($dest_folder, Callable $modifyName = null) {
        if (!isset($_FILES[$this->_file])) {
            return false;
        }
        
        if (is_array($_FILES[$this->_file]['name'])) {
            // Multiple file uploads
            $count = count($_FILES[$this->_file]['name']);
            $stored = [];
            $fails = [];
            
            for ($i = 0; $i < $count; $i++) {
                // Get modified name from callback
                $dest = rtrim($dest_folder, '/') . '/' . 
                    (is_callable($modifyName) ? $modifyName($_FILES[$this->_file]['name'][$i]) : $_FILES[$this->_file]['name'][$i]);
                
                if (File::rename($_FILES[$this->_file]['tmp_name'][$i], $dest)) {
                    // Record all uploaded files
                    $stored[] = $_FILES[$this->_file]['name'][$i];
                } else {
                    $fails[] = $_FILES[$this->_file]['name'][$i];
                }
            }
            
            return [
                    'stored' => $stored,
                    'failed' => $fails
                ];
        }
        
        // Single file upload
        $dest = rtrim($dest_folder, '/') . '/' . 
            (is_callable($modifyName) ? $modifyName($_FILES[$this->_file]['name']) : $_FILES[$this->_file]['name']);
        
        return File::rename($_FILES[$this->_file]['tmp_name'], $dest);
    }
public function store ( $ dest_folder , Callable $ modifyName = null ) { if ( ! isset ( $ _FILES [ $ this -> _file ] ) ) { return false ; } if ( is_array ( $ _FILES [ $ this -> _file ] [ 'name' ] ) ) { // Multiple file uploads $ count = count ( $ _FILES [ $ this -> _file ] [ 'name' ] ) ; $ stored = [ ] ; $ fails = [ ] ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { // Get modified name from callback $ dest = rtrim ( $ dest_folder , '/' ) . '/' . ( is_callable ( $ modifyName ) ? $ modifyName ( $ _FILES [ $ this -> _file ] [ 'name' ] [ $ i ] ) : $ _FILES [ $ this -> _file ] [ 'name' ] [ $ i ] ) ; if ( File :: rename ( $ _FILES [ $ this -> _file ] [ 'tmp_name' ] [ $ i ] , $ dest ) ) { // Record all uploaded files $ stored [ ] = $ _FILES [ $ this -> _file ] [ 'name' ] [ $ i ] ; } else { $ fails [ ] = $ _FILES [ $ this -> _file ] [ 'name' ] [ $ i ] ; } } return [ 'stored' => $ stored , 'failed' => $ fails ] ; } // Single file upload $ dest = rtrim ( $ dest_folder , '/' ) . '/' . ( is_callable ( $ modifyName ) ? $ modifyName ( $ _FILES [ $ this -> _file ] [ 'name' ] ) : $ _FILES [ $ this -> _file ] [ 'name' ] ) ; return File :: rename ( $ _FILES [ $ this -> _file ] [ 'tmp_name' ] , $ dest ) ; }
Store temporary files to destination path of uploads

@access  public
@param   string      $dest_folder    Destination path
@param   Callable    $modifyName     Name modification callback
@return  mixed       Returns `false` if upload fails. Returns `array` of
stored and failed files for multiple file upload.
Store temporary files to destination path of uploads