[英]Is there any alternative to input type file for file upload now that Android 4.4 no longer supports is?
I know there are a couple of threads on this but none of them seem to have a solution. 我知道有两个线程,但是似乎都没有解决方案。 I'm developing my final year project at the minute as an Android mobile application.
我目前正在开发自己的最后一个项目,作为一个Android移动应用程序。 One of my features was a file upload inside a HTML form in the in app browser of Phonegap project.
我的功能之一是在Phonegap项目的应用内浏览器中的HTML表单内上传文件。 However, since my phone upgraded to Android KitKat 4.4, it no longer works as apparently it's unsupported.
但是,由于我的手机已升级到Android KitKat 4.4,因此显然不再受支持,因此无法再使用。 I tried http://www.script-tutorials.com/pure-html5-file-upload/ tutorial but it also fails to work inside the inapp browser?
我尝试了http://www.script-tutorials.com/pure-html5-file-upload/教程,但是在inapp浏览器中也无法正常工作吗? Is there anything else or any other way I can try before I have to scrap this idea from my application?
在必须从应用程序中删除此想法之前,还有其他尝试或其他方法可以尝试吗? I really don't want to as it's a key feature and I'm going to lose marks.
我真的不想这么做,因为它是关键功能,而且我会失去分数。 Thanks lots, Paula
非常感谢,宝拉
You can try this I've read on the jira bug comments 您可以尝试一下我在jira错误注释中阅读的内容
Cesidio DiBenedetto added a comment - 28/Mar/14 01:27
Cesidio DiBenedetto添加了评论-2014年3月28日01:27
Hey all, I've been experiencing this issue as well so I wrote a Cordova FileChooser plugin to a "band-aid" for the time being.
大家好,我也一直遇到这个问题,因此我暂时将Cordova FileChooser插件编写为“创可贴”。 Basically, in Android 4.4(KitKat), as mentioned in previous comments, the file dialog is not opened.
基本上,在Android 4.4(KitKat)中,如前面的注释所述,不会打开文件对话框。 However the onclick event is still fired on so you can call the FileChooser plugin to open a file dialog and upon selection, you can set a variable that contains the full path to the file.
但是,onclick事件仍然会触发,因此您可以调用FileChooser插件打开文件对话框,选择后可以设置包含文件完整路径的变量。 At this point, you can use the FileTransfer plugin to upload to your server and hook into the onprogress event to show progress.
此时,您可以使用FileTransfer插件上载到服务器,并挂接onprogress事件以显示进度。 This plugin is mainly configured for Android 4.4 so I would recommend to continue to use the native file dialogs for earlier versions of Android.
这个插件主要是为Android 4.4配置的,因此,我建议对早期版本的Android继续使用本机文件对话框。 There might be issues with the plugin as I have not fully tested all possible scenarios on many devices, but I have installed it on a Nexus 5 and it worked fine.
该插件可能存在问题,因为我尚未在许多设备上对所有可能的情况进行全面测试,但是我已将其安装在Nexus 5上,并且工作正常。
https://github.com/cdibened/filechooser
https://github.com/cdibened/filechooser
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.