如何使用cordova从移动设备中选择任何类型的文件? [英] How to choose any type file from mobile devices using cordova ?
问题描述
Hi
如何从移动设备(Android,ios,windows)中选择任何类型的文件,目前我只能选择.jpg文件。我从不传递mime类型,但仍允许选择.jpg文件只有。
我尝试了什么:
我用的是这个用于选择文件的代码
Hi
How to choose any type of files from mobile devices (Android,ios,windows),Currently i can choose only .jpg file only.i never pass mime type,but still allow to choose .jpg file only.
What I have tried:
I am using this code to choose file
navigator.camera.getPicture(
uploadPhoto,
function (message) {
kendo.mobile.application.hideLoading();
$("#ErrorDiv").text("Failed to get a picture. Please select one.");
}, {
quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
// sourceType: navigator.camera.PictureSourceType.SAVEDPHOTOALBUM
});
此代码仅允许选择图像文件,但我想从移动设备中获取任何类型的文件,例如sd,内部卡,谷歌驱动器,下载等。
问候
Aravind
This code only allow to choose image file only,but i want to any type of file from mobile devices,like from sd ,internal card,google drive,Downloads etc.
Regards
Aravind
推荐答案
( #ErrorDiv)。text( 无法获得图片。请选择一个。);
},{
质量: 50 ,
destinationType: navigator .camera.DestinationType.FILE_URI,
sourceType: navigator .camera.PictureSourceType.PHOTOLIBRARY
< span class =code-comment> // sourceType:navigator.camera.PictureSourceType.SAVEDPHOTOALBUM
});
("#ErrorDiv").text("Failed to get a picture. Please select one."); }, { quality: 50, destinationType: navigator.camera.DestinationType.FILE_URI, sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY // sourceType: navigator.camera.PictureSourceType.SAVEDPHOTOALBUM });
此代码仅允许选择图像文件,但我想从移动设备中获取任何类型的文件,例如sd,内部卡,谷歌驱动器,下载等
问候
Aravind
This code only allow to choose image file only,but i want to any type of file from mobile devices,like from sd ,internal card,google drive,Downloads etc.
Regards
Aravind
这篇关于如何使用cordova从移动设备中选择任何类型的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!