public function uploadField($key, $label=null, array $attr=[]) {
		$remove = false;
		$current = false;

		if ( array_key_exists('remove', $attr) ){
			$remove = $attr['remove'];
			unset($attr['remove']);
		}

		if ( array_key_exists('current', $attr) ){
			$current = $attr['current'];
			unset($attr['current']);
		}

		$attr['name'] = $key; /* fulhack för att PHP är CP */
		$upload = $this->factory("file", $key, $label, $attr);
		$this->fields[] = $upload;
		$this->addField($upload);

		if ( $current !== false ){
			$attr = [];
			list($id, $name,) = $this->generateData($key . '_current', $attr);
			$field = new ManualField("{$key}_current", '', "<label>$current</label>", false);
			return $this->addField($field);
		}

		if ( $remove ){
			$attr = [];
			list($id, $name,) = $this->generateData($key . '_remove', $attr);
			$field = new ManualField("{$key}_remove", '', "<label><input type='checkbox' name='$name' id='$id' value='1' />Ta bort</label>", false);
			return $this->addField($field);
		}

		return $upload;
	}
public function uploadField($key, $label=null, array $attr=[]) {
		$remove = false;
		$current = false;

		if ( array_key_exists('remove', $attr) ){
			$remove = $attr['remove'];
			unset($attr['remove']);
		}

		if ( array_key_exists('current', $attr) ){
			$current = $attr['current'];
			unset($attr['current']);
		}

		$attr['name'] = $key; /* fulhack för att PHP är CP */
		$upload = $this->factory("file", $key, $label, $attr);
		$this->fields[] = $upload;
		$this->addField($upload);

		if ( $current !== false ){
			$attr = [];
			list($id, $name,) = $this->generateData($key . '_current', $attr);
			$field = new ManualField("{$key}_current", '', "<label>$current</label>", false);
			return $this->addField($field);
		}

		if ( $remove ){
			$attr = [];
			list($id, $name,) = $this->generateData($key . '_remove', $attr);
			$field = new ManualField("{$key}_remove", '', "<label><input type='checkbox' name='$name' id='$id' value='1' />Ta bort</label>", false);
			return $this->addField($field);
		}

		return $upload;
	}
public function uploadField ( $ key , $ label = null , array $ attr = [ ] ) { $ remove = false ; $ current = false ; if ( array_key_exists ( 'remove' , $ attr ) ) { $ remove = $ attr [ 'remove' ] ; unset ( $ attr [ 'remove' ] ) ; } if ( array_key_exists ( 'current' , $ attr ) ) { $ current = $ attr [ 'current' ] ; unset ( $ attr [ 'current' ] ) ; } $ attr [ 'name' ] = $ key ; /* fulhack för att PHP är CP */ $ upload = $ this -> factory ( "file" , $ key , $ label , $ attr ) ; $ this -> fields [ ] = $ upload ; $ this -> addField ( $ upload ) ; if ( $ current !== false ) { $ attr = [ ] ; list ( $ id , $ name , ) = $ this -> generateData ( $ key . '_current' , $ attr ) ; $ field = new ManualField ( "{$key}_current" , '' , "<label>$current</label>" , false ) ; return $ this -> addField ( $ field ) ; } if ( $ remove ) { $ attr = [ ] ; list ( $ id , $ name , ) = $ this -> generateData ( $ key . '_remove' , $ attr ) ; $ field = new ManualField ( "{$key}_remove" , '' , "<label><input type='checkbox' name='$name' id='$id' value='1' />Ta bort</label>" , false ) ; return $ this -> addField ( $ field ) ; } return $ upload ; }
File upload field.

@option remove {boolean} If true a checkbox to remove the current value will be added.
@option current {html} If set to non-false the content will be displayed as the
current value, e.g can be set to &lt;img ..&gt; to display the
current uploaded image.
File upload field .