Habari\FormControlFile::save PHP Method

save() public method

Store this control's value under the control's specified key.
public save ( string $storage = null )
$storage string (optional) A storage location to store the control data
    public function save($storage = null)
    {
        if ($storage == null) {
            $storage = $this->storage;
        }
        if (is_string($storage)) {
            $storage = explode(':', $storage, 2);
            switch (count($storage)) {
                case 2:
                    list($type, $location) = $storage;
                    break;
                default:
                    return;
            }
        }
        switch ($type) {
            case 'silo':
                // TODO
                // Get silo by path $location
                // Create a MediaAsset based on $_FILES[$this->name]['tmp_name']
                break;
            case 'path':
                move_uploaded_file($_FILES[$this->field]['tmp_name'], $location . '/' . basename($_FILES[$this->field]['name']));
                break;
                /* TODO is there any use for any of these ?
                		case 'user':
                			User::identify()->info->{$location} = $this->value;
                			break;
                		case 'option':
                			Options::set( $location, $this->value );
                			break;
                		case 'action':
                			Plugins::filter($location, $this->value, $this->name, true);
                			break;
                		case 'formstorage':
                			$storage->field_save( $this->name, $this->value );
                			break;
                			*/
            /* TODO is there any use for any of these ?
            		case 'user':
            			User::identify()->info->{$location} = $this->value;
            			break;
            		case 'option':
            			Options::set( $location, $this->value );
            			break;
            		case 'action':
            			Plugins::filter($location, $this->value, $this->name, true);
            			break;
            		case 'formstorage':
            			$storage->field_save( $this->name, $this->value );
            			break;
            			*/
            case 'null':
                break;
        }
    }
FormControlFile