Ionic Cordova FileUpload错误:不允许加载本地资源 [英] Ionic Cordova FileUpload error: Not allowed to load local resource

查看:1304
本文介绍了Ionic Cordova FileUpload错误:不允许加载本地资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Ionic的新手,我正在尝试上传从Android文件系统中存储的相机拍摄的图像:

I am new to Ionic and I am trying to upload an image taken from camera that is stored in Android filesystem:

var ft = new FileTransfer();
console.log('Uploading: ' + fileURL);
ft.upload(fileURL,
  encodeURI("http://192.168.192.62:3000/api/meals/picture"),
  pictureUploaded,
  function(error) {
    console.err(error);
    $ionicLoading.show({template: 'Ooops error uploading picture...'});
    setTimeout(function(){$ionicLoading.hide();}, 3000);
  },
  options);

var pictureUploaded = function() {
  console.log('uploaded!');
  $ionicLoading.hide();
};

fileUrl指向现有的图像:file:///data/data/com.ionicframework。 nutrilifemobile664547 / files / Q2AtO1462636767466.jpg

fileUrl is pointing to an existent image: file:///data/data/com.ionicframework.nutrilifemobile664547/files/Q2AtO1462636767466.jpg

在chrome:// inspect /#devices console中我收到以下错误,看起来因为错误而FileOptions也没有正确发送,这是错误(不允许加载本地资源):

In chrome://inspect/#devices console I get the following error and it looks like because of the error the FileOptions are also not properly sent, this is the error (Not allowed to load local resource):

Cordova版本:6.1.1
离子版本:1.7.14

Cordova version: 6.1.1 Ionic version: 1.7.14

任何想法?我一直坚持这个错误。

Any ideas? I've been stuck with this error for a while.

推荐答案

当您使用Ionic的livereload选项时会发生这种情况。

This happens when you use the "livereload" option with Ionic.

尝试在正常模式下运行

这篇关于Ionic Cordova FileUpload错误:不允许加载本地资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆