Open ghost opened 6 years ago
Hi @proverbface, thanks for your thanks and your suggestion.
We can certainly add that functionality. I started a new branch for adding some preprocessors or other functions before starting the upload a while ago (See also https://github.com/fris-fruitig/react-firebase-file-uploader/issues/11#issuecomment-344598190). I think we could add a check for file size in a similar way like this:
const MAX_SIZE = 1e6; // in bytes
...
<FileUploader
beforeUploadStart={file => { if (file.size > MAX_FILE_SIZE) throw Error('File too large') }}
...
/>
Would this work for you or would you prefer a maxSize
prop? Other suggestions are welcome as well.
Thanks for your quick reply. I think both ways would make sense. The maxSize prop sounds even nicer.
any updates on this issue?
Would also love to see this implemented :)
@sprmn Hi, I added beforeUploadStart
into<CustomUploadButton />
and I got a warning
Warning: React does not recognize the beforeUploadStart prop on a DOM element
Any suggestion please?
Could we add file size limit api to this library? Thanks for the awesome work here.