Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Support for "file" type #24

@funmu

Description

@funmu

reacts-hooks-helper is a nice compact library that helps with forms and steps management.

When using the useForm() with input of type="file" , I found that the default binding does not preserve the values.
Any insights on how to use the helper with file inputs.

For example

const GetFileData = (props) => {
  const { formData, setForm } = useForm( initialData);
 
 // ... some code skipped


  return (
     <form>
            <input type="file" id="inputfile" name="inputfile" onChange={setForm} />
     </form>
  ); 

};

For example when I upload a file, say "TestFile.txt"

the resulting formData does not have the file, but instead only has the file name as:
formData = { inputfile: "c:\fakepath\TestFile.txt" }

is there a workaround?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions