Skip to main content

FilePicker

FilePicker widgetFilePicker widget

Browse the filesystem for a single path. It collects the chosen path (a string).

$p->filePicker('list', 'Price list')
->startIn(getcwd()) // Directory to open in (and the floor for ←).
->filesOnly() // Only files are selectable; directories stay navigable.
->extensions(['csv']) // Limit selectable files to these extensions.
->showHidden(); // Show hidden (dot) entries when the browser opens.

Options

NameDescriptionRequiredDefault
startIn()Directory the browser opens in, and the floor it cannot ascend above.NoCurrent directory
filesOnly()Only files are selectable; directories stay navigable.NoFiles and directories
directoriesOnly()Only directories are selectable.NoFiles and directories
extensions()Restrict selectable files to these extensions (dot-less, case-insensitive).NoAll
showHidden()Show hidden (dot) entries when the browser opens.NoOff
pageSize()Entries shown before the list pages around the cursor.No10

filesOnly() and directoriesOnly() are mutually exclusive - the last one set wins.

Keyboard

KeyAction
/ Move the highlight
Descend into the highlighted directory
Ascend to the parent (never above the start directory)
printable keysFilter the current directory
TabToggle hidden entries
BackspaceDelete a filter character, or ascend when the filter is empty
EnterSelect the highlighted entry if selectable, otherwise descend into the directory
EscCancel

Display modes

In all four display modes - Unicode or ASCII, colour on or off:

ANSINo ANSI
UnicodeFile picker: Unicode + ANSIFile picker: Unicode + ANSIFile picker: Unicode + No ANSIFile picker: Unicode + No ANSI
ASCIIFile picker: ASCII + ANSIFile picker: ASCII + ANSIFile picker: ASCII + No ANSIFile picker: ASCII + No ANSI