uploadSignature error handling

Comments

2 comments

  • Avatar
    Raya Straus

    Hi Alex,

    If you're using our new upload widget (v2) then the implementation will be similar to the following-

    cloudinary.openUploadWidget({
      uploadPreset: "docs_preset",
      showCompletedButton: true,
      }, (error, result) => {
        const eventData = result.data;
        if (eventData.event === "success") {
          console.log("upload success ==> ",result); 
          });
    });
    

    For more information on our v2 upload widget and event handling please see the following- https://cloudinary.com/documentation/upload_widget_2#api_events

     

    -1
    Comment actions Permalink
  • Avatar
    Alex Bjørlig

    HI @Raya.

     

    Thanks for your answer, but I think you might have misread the question or maybe it was not precise enough. I was asking about the uploadSignature function.

     

    Tak for example the official example: 

      <script type="text/javascript">
        var generateSignature = function(callback, params_to_sign){
          $.ajax({
           url     : https://www.my-domain.com/my_generate_signature",
           type    : "GET",
           dataType: "text",
           data    : { data: params_to_sign},
           complete: function() {console.log("complete")},
           success : function(signature, textStatus, xhr) { callback(signature); },
           error   : function(xhr, status, error) { console.log(xhr, status, error); }
          });
        }
      </script>

    Here there is no error handling implementation, other than logging. Should the error not be passed back as the callback?

    I experimented with that in my implementation, but the upload widget then throws a weird error about unsigned upload?

    0
    Comment actions Permalink

Please sign in to leave a comment.