Setting Values
You can set the upload field type value with a file's ID.
$entry->example = 10;
You can also set the value with an instance of a file.
$entry->example = $file;
Lastly you can set the value with an instance of a file presenter.
$entry->example = $decorated;
Multipart Form Data
When using the Upload field type in a form and utilizing a custom layout/output you MUST define the form's enctype
.
{% set form = form('example', 'stream').get() %}
{{ form.open({'enctype': 'multipart/form-data'})|raw }}
...
{{ form.close|raw }}