我正在使用nativescript usign mediafilepicker插件进行图像上传,但是我无法解析图像的URL进行预览并将其发送到服务器
我已经遵循了一些教程,但是它也不起作用
this.mdf.on("getFiles", (res: any) => {
let results = res.object.get('results');
results.forEach(element => {
let millisecondes = (new Date).getTime();
let folder = fs.knownFolders.documents();
console.log('folder ',folder);
let path = fs.path.join(folder.path, millisecondes + ".png");
// let saved = element.saveFileTo(path, "png")
this._ngZone.run(() => {
this.myImg = path;
console.log('img 1', this.myImg);
})
});
});
这是元素的输出:
{
"type": "image",
"file": "/storage/emulated/0/DCIM/Camera/IMG_20190402_002707.jpg",
"rawData": {}
}
这是文件夹的输出
{
"_path": "/data/user/0/org.nativescript.eportfolio/files",
"_isKnown": true
}
但我总是会收到此错误
读取位图时出错-java.io.FileNotFoundException
如果有任何帮助,我将非常感谢,谢谢