Skip to content
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

File upload doesn't work on webview #11230

Closed
BogdanHossu opened this issue Nov 30, 2016 · 39 comments
Closed

File upload doesn't work on webview #11230

BogdanHossu opened this issue Nov 30, 2016 · 39 comments

Comments

@BogdanHossu
Copy link

@BogdanHossu BogdanHossu commented Nov 30, 2016

Description

When I am pressing a input file button inside the webview, nothing happens.
I am trying somehow to fix the core webview because I am using a module on top of this webview but also that one has the same problem.

Additional Information

  • React Native version: 0.34
  • Platform: Android
  • Operating System: MacOS
@lacker
Copy link
Contributor

@lacker lacker commented Nov 30, 2016

Can you provide a sample app like a rnplay.org link that reproduces this? Especially if there is some error from the webview that would be helpful to know.

@BogdanHossu
Copy link
Author

@BogdanHossu BogdanHossu commented Nov 30, 2016

I have made a small example here https://rnplay.org/apps/JFUPjw so if you press choose file nothing will happen. I am expecting a file selector from the local files. And the module/package I am using for my webview is this https://github.com/alinz/react-native-webview-bridge.

@lacker
Copy link
Contributor

@lacker lacker commented Nov 30, 2016

Does this work if you just make a regular iOS app and use that WebView? It is not clear to me that regular web pages are supposed to get file-upload-request permissions inside mobile apps.

@BogdanHossu
Copy link
Author

@BogdanHossu BogdanHossu commented Nov 30, 2016

Yes, this does work in iOS app.

@hey99xx
Copy link

@hey99xx hey99xx commented Dec 1, 2016

For Android; is it possible you need a permission to read files from the system? Or there might be a need for a native code to handle this. Reading http://stackoverflow.com/questions/24470932/html-file-upload-doesnt-show-gallery-on-android and https://code.google.com/p/android/issues/detail?id=62220 I'm not sure if the default WebView client supports this out of the box.

@nhayfield
Copy link

@nhayfield nhayfield commented Feb 13, 2017

@the-ant those might work but they don't have all the new onMessage functionality and are outdated

@ilp2020
Copy link

@ilp2020 ilp2020 commented Feb 14, 2017

@nhayfield At last, I decided to use the crosswalk webview

@BogdanHossu
Copy link
Author

@BogdanHossu BogdanHossu commented Feb 14, 2017

In the end I used the code from this repo. Where I have created my own webview so also the onMessage functionality is there and the file upload.

@nhayfield
Copy link

@nhayfield nhayfield commented Feb 16, 2017

@the-ant yeah i been looking at crosswalk but its still not fully functional for what i need yet. might have to put in some Pull Requests on it

@Oblongmana
Copy link

@Oblongmana Oblongmana commented Mar 12, 2017

Over the weekend I needed this functionality on Android for a deadline, so I reworked one of the above repos into a library that can be installed into an existing project using the usual process (npm install plus manual linking) - https://github.com/Oblongmana/react-native-webview-file-upload-android.

It still has the limitation of the original repo that it only works with image uploads from the gallery - but PRs to add other input handling are welcomed, and should be relatively simple, the codebase has been stripped down significantly.

For anyone struggling with iOS, you only need to add the NSPhotoLibraryUsageDescription key and a description of why you need Photo Library access into your info.plist

@farazs
Copy link
Contributor

@farazs farazs commented Mar 30, 2017

See my PR for this on Android: #12807

@hramos
Copy link
Contributor

@hramos hramos commented Jul 20, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

@hramos hramos added the Icebox label Jul 20, 2017
@hramos hramos closed this Jul 20, 2017
@farazs
Copy link
Contributor

@farazs farazs commented Jul 21, 2017

Not sure this should be closed. There is a working PR to fix it, that just needs to be reviewed and merged.

@hramos
Copy link
Contributor

@hramos hramos commented Jul 21, 2017

I'll comment on the PR as well, but my impression here is that WebView is one of those components that probably should be split out of core and provided as a separate package.

@negati-ve
Copy link

@negati-ve negati-ve commented Aug 20, 2017

bump
any update on this?
will react native support file upload from web view by default?

@SaKKo
Copy link

@SaKKo SaKKo commented Sep 20, 2017

Is this issue resolved? I'm still having the same problem.

@hushicai
Copy link

@hushicai hushicai commented Sep 29, 2017

I meet the same issue too...

@hushicai
Copy link

@hushicai hushicai commented Sep 29, 2017

I make a sample project hushicai/ReactNativeAndroidWebView, based on react-native-webview-android , but it just extends from the ReactWebViewManager.
Hope someone can benefits from it.

@ysweid
Copy link

@ysweid ysweid commented Feb 11, 2018

This is not fixed yet.

@alexstophel
Copy link

@alexstophel alexstophel commented Feb 13, 2018

@hramos Can you provide any further insight into why this should be a separate package? Your argument on the linked PR seems to be that it's because it doesn't impact Facebook's internal use cases, but doesn't it seem odd to require a package to add functionality to Android that exists on iOS? It's likely that any such package would quickly become outdated and unmaintained to add insult to injury.

I would imagine that most people use React Native with the hopes of reducing device specific code and this separation seems to encourage device specific code.

@eugene-belkovich
Copy link

@eugene-belkovich eugene-belkovich commented Feb 26, 2018

I'm also still having the same problem. Please reopen this issue

@sinanargun
Copy link

@sinanargun sinanargun commented Feb 26, 2018

I'm having the same problem too. Anyone solved the problem?

@Lxxyx
Copy link
Contributor

@Lxxyx Lxxyx commented Mar 4, 2018

Same problem.File upload is an basic operation. This should add to the feature.

@hfqf
Copy link

@hfqf hfqf commented Mar 5, 2018

m2 ,Help!

@anhtukhtn
Copy link

@anhtukhtn anhtukhtn commented May 3, 2018

Is the problem solved?. It's very basic operation.
Please help.

@fuxianwei
Copy link

@fuxianwei fuxianwei commented May 3, 2018

the same issue too

@EguchiRyo
Copy link

@EguchiRyo EguchiRyo commented May 9, 2018

Still happen

@1uokun
Copy link

@1uokun 1uokun commented May 18, 2018

+1

2 similar comments
@GabrielDuarteJr
Copy link

@GabrielDuarteJr GabrielDuarteJr commented May 25, 2018

+1

@dlehdanakf
Copy link

@dlehdanakf dlehdanakf commented May 26, 2018

+1

@farazs
Copy link
Contributor

@farazs farazs commented Jun 4, 2018

I have a PR that fixes this #12807 but it doesn't look like it's ever going to get merged because the facebook team would like webview moved out of the core repo.

You can still use the code from the PR in a forked react-native if you need this functionality.

@HosanaUFRRJ2014
Copy link

@HosanaUFRRJ2014 HosanaUFRRJ2014 commented Jun 6, 2018

When will React Native Team make this funcionality available in the core repo or make it work in a different module? We need to upload files through WebView!!!!!!!! It's a shame it's not working yet. I'm very disappointed, once I'm spending a lot of time trying to fix what you should've fixed more than a year ago. 👎

P.S: You should reopen this issue.

@1uokun
Copy link

@1uokun 1uokun commented Jun 7, 2018

Please be grateful @HosanaUFRRJ2014

@yasicmd
Copy link

@yasicmd yasicmd commented Jun 17, 2018

any updates?

@ManvendraFlipkart
Copy link

@ManvendraFlipkart ManvendraFlipkart commented Jun 24, 2018

I haven't got any solution from this conversation yet! Tried almost everything.
Anyone has any working solution?
Thanks in advance!

@ManvendraFlipkart
Copy link

@ManvendraFlipkart ManvendraFlipkart commented Jun 25, 2018

Okay one solution finally worked for me :)
If you are using RN version 0.50+ then simple follow the instructions in the below link:
https://github.com/andreipfeiffer/react-native-webview-android-file-upload

Or else you will have to upgrade your RN version first (which turned out to be a tedious task for us)

Hope this helps!

@vitorreis
Copy link

@vitorreis vitorreis commented Jun 28, 2018

+1 on this feature/bugfix

@viv3kk
Copy link

@viv3kk viv3kk commented Jul 4, 2018

+1 for this feature as this is very native feature which should be included.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet