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.

Uploader component does not provide correct type info

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.3.1

Environment

N/A

Reproduction link

Edit on CodeSandbox

Steps to reproduce

click upload, select a file

What is expected?

console output has originFileObj, is UploadFile!!!

What is actually happening?

console output nop, not a upload file


in Upload component’s typing, it claims beforeUpload callback will receive a UploadFile typed object, but in fact we receive a File object. Which causes a lot of trouble when using in TypeScript, for now we write a lot of as any as File type cast just to get a correct type.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

15reactions
yesmeckcommented, Mar 23, 2018

The file is the “originFileObj”

2reactions
pizncommented, Mar 25, 2018

Which causes a lot of trouble when using in TypeScript, for now we write a lot of as any as File type cast just to get a correct type.

This is not a reason to modify the file type. beforeUpload should be return the real File for user to control, such like file verification.

eg: On beforeupload to get image size with use fileReader / window.URL. createObjectURL(file).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How You Can Fix The Biggest Problem With React File Upload
This step is crucial in view of uploading files because you must set the content type to multipart/form-data, or else it won't run...
Read more >
Testcafe - Unable to upload files with input type="url" which is ...
I am trying to upload a file but getting error "The specified selector does not match a file input element", I know testcafe...
Read more >
React Uploader API component - Syncfusion
Specifies the extensions of the file types allowed in the uploader ... The uploader component does not allow to interact when this property...
Read more >
lightning-file-upload - documentation - Salesforce Developers
A lightning-file-upload component provides an easy and integrated way for users to upload multiple files. You can configure the file uploader to accept ......
Read more >
Understanding and Correcting MSDS File Upload Errors
errors in the XML schema are found, the file will not process. ... Error messages that occur after a file upload in MSDS...
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