-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upload accepting wrong file type #11
Comments
@fweffort thanks for opening this issue. I will try to look into it this weekend. I guess you could already fix this by overwriting the onChange function and calling the startUpload function manually in a similar way as suggested here. If you check the MIME type in the onChange function, you can determine whether or not you'd like to call the startUpload function or present a warning/error to the user. I'm planning on adding the possibility to perform some checks or preprocessing before files are uploaded. There should be a way to cancel the upload in these functions. |
I cannot update this, as I am hosting it in firebase, and on deploy
firebase will download your code again and will use yours instead of mine.
but please, keep me updated when I can use this.
I really like the way it runs. suits my application very well.
thanks!!
Em 9 de nov de 2017 06:48, "Frank van der Hoek" <[email protected]>
escreveu:
… @fweffort <https://github.com/fweffort> thanks for opening this issue. I
will try to look into it this weekend. I guess you could already fix this
by overwriting the onChange function and calling the startUpload function
manually in a similar way as suggested here
<#4 (comment)>.
If you check the MIME type in the onChange function, you can determine
whether or not you'd like to call the startUpload function or present a
warning/error to the user. I'm planning on adding the possibility to
perform some checks or preprocessing before files are uploaded. There
should be a way to cancel the upload in these functions.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AfvpYgQtlQonGR-psOPf__Gj9nzNv_ayks5s0rxWgaJpZM4QTmST>
.
|
Oo, but you don't have to edit my code at all. The fix I'm suggesting is no change in this library, just a change in the code on your side. See #4 (comment). But of course you could also wait for me to fix it in the lib. Can't promise I'll have it fixed this weekend though. |
Whoops accidentally closed this issue. My bad |
@fweffort I added a new functionality in the preprocessing branch. You can now add a To try it you'll have to install this branch temporarily using:
If you want to use the new feature you'll have to provide the <FileUploader
beforeUploadStart={file => { if (!/^image\/.*/.test(file.type)) throw Error('Invalid type') }}
[other props]
/> Can you please confirm that it works for you? |
Hi @sprmn , can you commit this new feature? |
if you open the file selector and change to ., and then choose a zip for instance, it will fail validation and upload anyway.
is there any way to fix this
The text was updated successfully, but these errors were encountered: