question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

File upload types issue after upgrade to v6

See original GitHub issue

Describe the bug A clear and concise description of what the bug is. material-ui-dropzone which was working with RHF ^5.7.2 version having types issues for onSubmit method.

To Reproduce Steps to reproduce the behavior:

  1. Check the error in codesandbox.

Codesandbox link (Required) https://codesandbox.io/s/react-hook-form-issue-with-dropzone-t30w5?file=/src/App.tsx

Expected behavior Accept defined interface types to onSubmit method .

Additional context File Upload component.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
fakkiocommented, Jul 17, 2020

@Fakkio you can use NestedValue and SubmitHandler type.

interface FormData {
  image: NestedValue<File[]>;
}
...
const onSubmit: SubmitHandler<FormData> = (input) => {
  uploadImage('url', input.image[0]);
  console.log(input);
};

codesandbox

it worked (even with FileLIst), thanks @kotarella1110!

3reactions
iamchathucommented, Jul 17, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

I am getting "The File Type is not allowed" error, what shall I do?
PROBLEM : When I upload an image or video file I get "The File Type is not allowed" error (see image below):.
Read more >
Planning to upgrade to B2BI v6.0.3.4? Here is what you ... - IBM
Customers who upgrade to B2BI v6.0.3.4 from lower version encounter the problem of login and file upload failure on myFileGateway 2.0 UI.
Read more >
Tinymce v6 dropzone config options - Stack Overflow
P.S. The dropzone component does not support file types. But you can check the file types after they are uploaded.
Read more >
Common issues with Satellite 6 upgrade or installation
Upgrade to Satellite 6.9 fails at db:migrate stage with 'could not create unique index "indexlookup_values_on_lookup_key_id_andmatch"' error · [ ...
Read more >
How to Fix the “Sorry, This File Type Is Not Permitted for ...
Before you start changing your WordPress settings or files, check the extension of the file you're trying to upload. Maybe you accidentally ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found