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.

Property Description
label a name when displaying the form field to the user.
default specifies a default string value, optional.
comment places a descriptive comment below the field.
mode the expected file type, either file or image. Default: image
size for multiple uploads, the size of the container. Available options: tiny, small, large, huge, giant. Default: large
imageWidth if using image type, the image will be resized to this width, optional
imageHeight if using image type, the image will be resized to this height, optional
fileTypes file extensions that are accepted by the uploader, optional. Eg: zip,txt
mimeTypes MIME types that are accepted by the uploader, either as file extension or fully qualified name, optional. Eg: bin,txt
maxFilesize file size in Mb that are accepted by the uploader, optional. Default: from "upload_max_filesize" param value
maxFiles maximum number of files allowed to be uploaded
useCaption allows a title and description to be set for the file. Default: true
thumbOptions additional resize options for generating the thumbnail, or pass false to disable thumb generation.
deferredBinding use 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