Reference createFileInput()

createFileInput()

Creates an <input> element of type 'file'.

createFileInput() allows users to select local files for use in a sketch. It returns a p5.File object.

The first parameter, callback, is a function that's called when the file loads. The callback function should have one parameter, file, that's a p5.File object.

The second parameter, multiple, is optional. It's a boolean value that allows loading multiple files if set to true. If true, callback will be called once per file.

Examples

Syntax

createFileInput(callback, [multiple])

Parameters

callback
Function:

function to call once the file loads.

multiple
Boolean:

allow multiple files to be selected.

Returns

p5.File: new p5.File object.
Notice any errors or typos? Please let us know. Please feel free to edit src/dom/dom.js and open a pull request!

Related References