gpt4 book ai didi

android - 手机间隙 :Get the file from sdcard and upload it to the FTP Server in android

转载 作者:行者123 更新时间:2023-11-30 03:01:04 25 4
gpt4 key购买 nike

我是 phonegap developement 的新手。在我的应用程序中有一个按钮,单击该按钮,sdcard 的目录结构将打开,通过选择一个文件,所选文件将上传到FTP 服务器

我试过这个链接 ftpclient 但它没有指定如何打开目录结构和选择文件,它根本不起作用。

任何人都可以给我正确的步骤或上述解决方案。提前致谢。

最佳答案

这是 FileChooser 的插件,它可以让您选择从 SDCard 中选择文件。 cordova-filechooser .请像这样更改 filechooser.js 文件

(function( cordova ) {

function FileChooser() {}

FileChooser.prototype.open = function(win, fail) {
return cordova.exec(
function (args) { if(win !== undefined) { win(args); } },
function (args) { if(fail !== undefined) { fail(args); } },
"FileChooser", "open", []);
};

if(!window.plugins) {
window.plugins = {};
}

if (!window.plugins.FileChooser) {
window.plugins.FileChooser = new FileChooser();
}

})( window.cordova );

将此 js 文件添加到您的 js 文件夹中。并像这样使用

plugins.FileChooser.open(function (uri) {
// success
alert(uri);

},function () {
// fail
alert('failed');
});

关于android - 手机间隙 :Get the file from sdcard and upload it to the FTP Server in android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22524113/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com