file(), image() form()

A file input; the form becomes multipart/form-data. image() is the same with the default name image.

form()->file($name, $desc = '', $extra = [], $replace = [])
form()->image($name = '', $desc = '', $extra = [], $replace = [])

Options

OptionMeaning
acceptFile types the browser offers (image/*, .pdf).
(input options)Every option of input().

Example

Code

return form()
    ->file('manual', 'Manual (PDF)', ['accept' => '.pdf'])
    ->image('', 'Photo', ['accept' => 'image/*']);

Notes

  • The upload arrives in $_FILES: check type, size and name on the server, store it outside the web root or under a generated name.

See also: form/upload, demo:form/ckeditor_upload