user2413453
user2413453

Reputation:

Ionic FileUploadOptions is not defined

ionic.bundle.js:26771 ReferenceError: FileUploadOptions is not defined

I Keep receiving this error even though, The Cordova files are installed:

cordova-plugin-file

cordova-plugin-file-transfer

and also after adding DeviceReady() :

document.addEventListener('deviceready', function() { 
    angular.bootstrap(document, ['starter']);
  }, false);
angular.module('starter', ['ionic', 'ngCordova','starter.controllers']) 

My Code

..
 $scope.upload = function() {


console.log('2');
        $ionicLoading.show({template: 'Loading...'});
console.log('3');
        var fileURL = $scope.test;
console.log('4', fileURL);
        var options = new FileUploadOptions();
console.log('5');
..

Any Ideas?

Upvotes: 1

Views: 2569

Answers (2)

marton
marton

Reputation: 1350

In ionic you are using ngCordova, not cordova directly, so you don't need to define your options like that, you only have to pass a regular object, ngCordova takes care of the rest for you.

var options = {};

You have to work with the API of the $cordovaFileTransfer service, which wraps the cordova plugin, check out these docs .

Edit:

Above link is spam.Please don't click.

Upvotes: 1

Naitik
Naitik

Reputation: 1465

you need to test in real device with assign local ip address in local service.

according to your comment you try in browser because you want to debug your app and you are using IOS platform.

so for test real device for ios you just need to follow:

Debug real ios device

for test real device android you need to run your app in andorid keep connect that device with your machine and in chrome you just go to chrome://inspect/#devices there you can find your app in device you just need to do inspect there and you can debug you android app as well.

I know it already helps you a lot but i add answer here so other can also get solution. :)

Happy Coding.

Cheers..

Upvotes: 1

Related Questions