The createFileInput() function is used to create an input element with the type of ‘file’ that can be used by the user to select local files to be used in the sketch. It also supports the selection of multiple files if required.
Parameters: This function accepts two parameters as mentioned above and described below:
- callback: It is the callback function that would be used when the file is loaded. It is an optional parameter.
- multiple: It is a string which specifies if multiple files are allowed to be selected at once. It can be set to “true” or “false”. It is an optional parameter.
Return Value: It returns a pointer to the p5.Element holding the created file object.
Below examples illustrate the createFileInput() function in p5.js:
Example 1: In this example, we will take one file as an input.
Example 2: In this example, we will take multiple files as an input.
Online editor: https://editor.p5js.org/
- How to get the function name inside a function in PHP ?
- p5.js | sin() function
- p5.js | mag() Function
- PHP | Ds\Set xor() Function
- D3.js | d3.map.set() Function
- PHP | min( ) Function
- PHP | max( ) Function
- p5.js | log() function
- p5.js | arc() Function
- p5.js | max() function
- p5.js | hue() function
- D3.js | d3.hsl() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.