File Upload Field

File Upload Field

Form Widget

fileupload - renders a file uploader for images or regular files.

avatar:
    label: Avatar
    type: fileupload
    mode: image
    imageHeight: 260
    imageWidth: 260

The following field properties are supported and commonly used.

PropertyDescription
labela name when displaying the form field to the user.
defaultspecifies a default string value, optional.
commentplaces a descriptive comment below the field.
modethe expected file type, either file or image. Default: image
sizefor multiple uploads, the size of the container. Available options: tiny, small, large, huge, giant. Default: large
imageWidthif using image type, the image will be resized to this width, optional
imageHeightif using image type, the image will be resized to this height, optional
fileTypesfile extensions that are accepted by the uploader, optional. Eg: zip,txt
mimeTypesMIME types that are accepted by the uploader, either as file extension or fully qualified name, optional. Eg: bin,txt
maxFilesizefile size in Mb that are accepted by the uploader, optional. Default: from "upload_max_filesize" param value
maxFilesmaximum number of files allowed to be uploaded
useCaptionallows a title and description to be set for the file. Default: true
thumbOptionsadditional resize options for generating the thumbnail, or pass false to disable thumb generation.
deferredBindinguse deferred binding when uploading a file, when available. Disable this to attach the file immediately on upload instead of when saving. Default: true

Unlike the Media Finder form widget, the File Upload form widget uses database file attachments so the field name be that of an attachOne or attachMany relationship attribute on your associated model.

On This Page