W3cubDocs

/Symfony 2.8

Symfony\Component\DomCrawler\Field\FileFormField

class FileFormField extends FormField

FileFormField represents a file form field (an HTML file input tag).

Methods

__construct(DOMElement $node)

Constructor.

from FormField
string getName()

Returns the name of the field.

from FormField
string|array getValue()

Gets the value of the field.

from FormField
setValue(string $value)

Sets the value of the field.

bool hasValue()

Returns true if the field should be included in the submitted values.

from FormField
bool isDisabled()

Check if the current field is disabled.

from FormField
setErrorCode(int $error)

Sets the PHP error code associated with the field.

upload(string $value)

Sets the value of the field.

setFilePath(string $path)

Sets path to the file as string for simulating HTTP request.

Details

public __construct(DOMElement $node)

Constructor.

Parameters

DOMElement $node The node associated with this field

public string getName()

Returns the name of the field.

Return Value

string The name of the field

public string|array getValue()

Gets the value of the field.

Return Value

string|array The value of the field

public setValue(string $value)

Sets the value of the field.

Parameters

string $value The value of the field

public bool hasValue()

Returns true if the field should be included in the submitted values.

Return Value

bool true if the field should be included in the submitted values, false otherwise

public bool isDisabled()

Check if the current field is disabled.

Return Value

bool

public setErrorCode(int $error)

Sets the PHP error code associated with the field.

Parameters

int $error The error code (one of UPLOADERRINISIZE, UPLOADERRFORMSIZE, UPLOADERRPARTIAL, UPLOADERRNOFILE, UPLOADERRNOTMPDIR, UPLOADERRCANTWRITE, or UPLOADERREXTENSION)

Exceptions

InvalidArgumentException When error code doesn't exist

public upload(string $value)

Sets the value of the field.

Parameters

string $value The value of the field

public setFilePath(string $path)

Sets path to the file as string for simulating HTTP request.

Parameters

string $path The path to the file

© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/2.8/Symfony/Component/DomCrawler/Field/FileFormField.html