Skip to main content

Add additional values when uploading via jQuery

Comments

2 comments

  • Chris Hill

    Well it turns out the problem was very, very sneaky. This should also most likely fix your angular example as well. It looks like the object returned from the series of on() calls is not the same value as $(".cloudinary_fileupload"). I fixed the issue by doing:

    $scope.widget = $(".cloudinary_fileupload"); $scope.widget.unsigned_cloudinary_upload(cloudinary.config().upload_preset, {}, {
    ...etc...

    It took me way too long to figure this out because the object returned from the on() calls looks identical to the value returned from $(".cloudinary_fileupload"), even in the debugger.

    It was only until I did this:

      var thing1 = $(".cloudinary_fileupload");
      var thing2 = $scope.widget;
      var thingsAreSame = thing1 == thing2;
      //thingsAreSame is false
    

    That I saw it return false.

    0
  • Chris Hill

    Follow-up: apparently I need to always grab the variable via $(".cloudinary_fileupload") instead of storing the value in $scope.widget. I'm not exactly sure, because I'm newish to JS and all this method chaining is new to me.

    0

Post is closed for comments.