# How to make uploading files or images using ionicframwork or angularJS

**URL:** <https://forum.ionicframework.com/t/how-to-make-uploading-files-or-images-using-ionicframwork-or-angularjs/391>\
**Category:** ionic-v1\
**Created:** [January 3, 2014, 6:18am UTC](https://forum.ionicframework.com/t/how-to-make-uploading-files-or-images-using-ionicframwork-or-angularjs/391 "2014-01-03T06:18:25Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Sebastian](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@Sebastian](https://forum.ionicframework.com/u/Sebastian)\
**Post date:** [March 20, 2014, 9:20pm UTC](https://forum.ionicframework.com/t/how-to-make-uploading-files-or-images-using-ionicframwork-or-angularjs/391/7 "2014-03-20T21:20:29Z")

</div>

I am working on this problem as well.

I have the following controller:

```
.controller('CameraCtrl', function ($scope) {    

 $scope.takePic = function() {
    var options = {
        quality: 50,
        destinationType: Camera.DestinationType.DATA_URL,
        sourceType: 1, // 0:Photo Library, 1=Camera, 2=Saved Photo Album
        encodingType: 0 // 0=JPG 1=PNG
    }
    // Take picture using device camera and retrieve image as base64-encoded string
    navigator.camera.getPicture(onSuccess,onFail,options);
}
var onSuccess = function(imageData) {
    console.log("On Success! ");
    $scope.picData = "data:image/jpeg;base64," +imageData;
    $scope.$apply();
};

$scope.send = function() {            
var myImg = $scope.picData;
var options = new FileUploadOptions();
        options.fileKey="pics";
        options.chunkedMode = false;

        var params = {};
        params.user_token = localStorage.getItem('auth_token');
        params.user_email = localStorage.getItem('email');
        options.params = params;

    var ft = new FileTransfer();
    ft.upload(myImg.src, encodeURI("https://xxx.herokuapp.com/ics/"), onUploadSuccess, onUploadFail, options);
    
}

```

Taking pictures is working, but I cannot upload it. What am I doing wrong? I am thankful for any kind of hint.

---

_[View the full topic](https://forum.ionicframework.com/t/how-to-make-uploading-files-or-images-using-ionicframwork-or-angularjs/391)._
