wails/v3/examples/file-input/README.md
Lea Anthony 30ffbba060
feat(v3): add file-input-test example for #4862 (#4950)
* feat(v3): add file-input example for issue #4862

Minimal example demonstrating HTML file input functionality:
- Single file selection
- Multiple file selection
- Files or directories (webkitdirectory)
- Accept filter (note: not enforced by macOS)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(example): use JS runtime dialog API instead of Go backend

Update file-input example to use wails.Dialogs.OpenFile() from the
JS runtime instead of a custom Go FileService backend. This demonstrates
the recommended approach for dialog functionality.

Fixes #4862

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(example): use generated bindings for dialog API

Update file-input example to use proper generated bindings instead
of inline JS runtime calls. The example now demonstrates:
- HTML file input elements (single, multiple, webkitdirectory)
- Wails Dialog API via generated FileService bindings

Fixes #4862

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add changelog entry for macOS file input fix

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 07:29:15 +11:00

638 B

File Input Example

Tests HTML <input type="file"> and Wails Dialog API functionality (#4862).

Test Cases

HTML File Input:

  1. Single File - Basic file selection
  2. Multiple Files - Multi-select with multiple attribute
  3. Files or Directories - Selection with webkitdirectory attribute

Wails Dialog API (via generated bindings): 4. Directory Only - CanChooseDirectories(true) + CanChooseFiles(false) 5. Filtered (.txt) - Using AddFilter() for file type filtering

Run

# Generate bindings (already included)
wails3 generate bindings -d assets/bindings

# Run the app
go run .