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
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@BogdanHossu
Copy link

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 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

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 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

Yes, this does work in iOS app.

@hey99xx
Copy link

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.

@iapolog2u
Copy link

iapolog2u commented Dec 15, 2016

these two works:

https://github.com/dongyaQin/react-native-webview-file-upload

https://github.com/lucasferreira/react-native-webview-android

@nhayfield
Copy link

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

@iapolog2u
Copy link

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

@BogdanHossu
Copy link
Author

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

@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

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

farazs commented Mar 30, 2017

See my PR for this on Android: #12807

@hramos
Copy link
Contributor

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 as completed Jul 20, 2017
@farazs
Copy link

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 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

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

@SaKKo
Copy link

SaKKo commented Sep 20, 2017

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

@hushicai
Copy link

I meet the same issue too...

@hushicai
Copy link

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 commented Feb 11, 2018

This is not fixed yet.

@alexstophel
Copy link

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 commented Feb 26, 2018

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

@sinanargun
Copy link

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

@Lxxyx
Copy link
Contributor

Lxxyx commented Mar 4, 2018

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

@hfqf
Copy link

hfqf commented Mar 5, 2018

m2 ,Help!

@anhtukhtn
Copy link

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

@fuxianwei
Copy link

the same issue too

@EguchiRyo
Copy link

Still happen

@1uokun
Copy link

1uokun commented May 18, 2018

+1

2 similar comments
@GabrielDuarteJr
Copy link

+1

@dlehdanakf
Copy link

+1

@farazs
Copy link

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 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 commented Jun 7, 2018

Please be grateful @HosanaUFRRJ2014

@yasicmd
Copy link

yasicmd commented Jun 17, 2018

any updates?

@ManvendraFlipkart
Copy link

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

@ManvendraFlipkart
Copy link

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

+1 on this feature/bugfix

@viv3kk
Copy link

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
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests