Skip to content

Wrong react file upload code #375

Open
@joubeh

Description

@joubeh

The react code in page "https://inertiajs.com/file-uploads" for uploading files using useForm hook has error.
<input type="file" value={data.avatar} onChange={e => setData('avatar', e.target.files[0])} />
The code value={data.avatar} should be removed. it gets error because: InvalidStateError: Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions