简体   繁体   English

文件选择器,用于在phonegapcordova android应用程序中从浏览本地存储中选择docx、pdf文件

[英]File chooser to choose docx,pdf file from browsing local storage in phonegap cordova android application

I have tried these plugins for phonegap cordova android app我已经为 phonegap cordova android app 尝试过这些插件

https://github.com/cdibened/filechooser https://github.com/cdibened/filechooser

github.com/don/cordova-filechooser github.com/don/cordova-filechooser

but unable to install them in my application, getting error like this;但无法在我的应用程序中安装它们,出现这样的错误;

Error: Failed to fetch plugin https://github.com/cdibened/filechooser.git via registry.错误:无法通过注册表获取插件https://github.com/cdibened/filechooser.git

I want to add functionality to upload pdf or doc file from phonegap to server but I unable to do that I know there is a filetransfer plugin but it only allows me to browse media like image or videos but not document files.我想添加将 pdf 或 doc 文件从 phonegap 上传到服务器的功能,但我无法做到这一点,我知道有一个文件传输插件,但它只允许我浏览图像或视频等媒体,而不是文档文件。

Please, it would be great if anyone help me to do that拜托,如果有人能帮我做到这一点,那就太好了

I'm stuck here.我被困在这里。

I believe you are using Cordova Version 7 where is there is a major change related to fetch.我相信您正在使用 Cordova 版本 7,其中与 fetch 相关的重大变化。 You may check out more info on this official link您可以在此官方链接上查看更多信息

So you have to use the following command to install the plugin:所以你必须使用以下命令来安装插件:

cordova plugin add https://github.com/cdibened/filechooser.git --nofetch科尔多瓦插件添加https://github.com/cdibened/filechooser.git --nofetch

The --nofetch flag gives you the pre-Cordova@7.0 behavior --nofetch标志为您提供了 Cordova@7.0 之前的行为

Thanks Gandhi for a reply but I tried that trick earlier but no succeed!感谢甘地的回复,但我早些时候尝试过这个技巧但没有成功!

I have resolved this issue by adding this plugin finally, now I can choose a pdf from mobile local storage and upload it to the server using Filetransfer plugin, If anyone want the source code , I will upload it here我终于通过添加这个插件解决了这个问题,现在我可以从移动本地存储中选择一个pdf并使用Filetransfer插件将其上传到服务器,如果有人想要源代码,我会在这里上传

Plugin link:插件链接:

https://www.jsdelivr.com/package/npm/cordova-plugin-file-chooser https://www.jsdelivr.com/package/npm/cordova-plugin-file-chooser

cmd: cordova plugin add cordova-plugin-file-chooser cmd:cordova 插件添加cordova-plugin-file-chooser

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM