Skip to content
React·Intermediate·Conceptual·1 min read

Why is a file input always uncontrolled?

Short interview answer

For security reasons, JavaScript cannot programmatically set a file input's value to an arbitrary file path — the browser only allows the user's own file-picker interaction to set it, so React can only read the selected file via a ref or the change event, never drive it via a value prop.

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Controlled vs. uncontrolled components

Related questions