Skip to main content

uploadSignature error handling

Comments

2 comments

  • 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
  • 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

Post is closed for comments.