class: FileChooser

FileChooser objects are dispatched by the page in the ‘filechooser’ event.

  1. page.on('filechooser', async (fileChooser) => {
  2. await fileChooser.setFiles('/tmp/myfile.pdf');
  3. });

fileChooser.element()

Returns input element associated with this file chooser.

fileChooser.isMultiple()

Returns whether this file chooser accepts multiple files.

fileChooser.page()

Returns page this file chooser belongs to.

fileChooser.setFiles(files[, options])

Sets the value of the file input this chooser is associated with. If some of the filePaths are relative paths, then they are resolved relative to the current working directory. For empty array, clears the selected files.