3

I am trying to get the blueimp file upload plugin to play nicely with my app, using angularjs. I am having one issue. My server returns json data upon a successful upload. The problem is I cannot retrieve this data, although I can find it in the console.

$scope.$on('fileuploadprocessdone', function(event, files){
                console.log(files);
            });

Console:

Object {disabled: false, create: null, dropZone: x.fn.x.init[1], pasteZone: x.fn.x.init[1], replaceFileInput: true…}
_progress: Object
_response: Object
    jqXHR: Object
    result: Object
    textStatus: "success"

I am trying to get the "result" Object in the "_response" object:

$scope.$on('fileuploadprocessdone', function(event, files){
                console.log(files._response);
                console.log(files.response);
            });

returns (console) :

Object {} //first console log
function () {
            return this._response;  //second console log
        } 

I can clearly see the data returned by the server in the first console.log(files). How can I accomplish this?

Thank you.

1 Answer 1

1

You can now prevent default event actions in Angular scope listeners, too:

   $scope.$on('fileuploaddone', function(e, data){
      console.log(data.result);
   }); 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.