Cloudinary jQuery plugin - upload from URL

Comments

2 comments

  • Avatar
    Itay Taragano

    Hi Ivan,

    Can you please post the relevant part of the html + js? If you can, a link to an online page would be even more helpful.

    You can o pen a support ticket if you want to communicate privately.

    0
    Comment actions Permalink
  • Avatar
    Ivan Ribakov

    For the record, problem was caused by delaying the upload process. I have overridden default fileupload 'add' event handler and called submit() method on the upload data manually. However cloudinary_upload_url() function relies on default behaviour.

    The following solution was proposed - take cloudinary_upload_url() code from source ( https://github.com/cloudinary/cloudinary_js/blob/master/js/jquery.cloudinary.js):

    $.fn.cloudinary_upload_url = function(remote_url) {

        this.fileupload('option', 'formData').file = remote_url;

        this.fileupload('add', { files: [ remote_url ] });

        delete(this.fileupload('option', 'formData').file);

      }

    and manually submit form data BEFORE delete() call like this:

     

    $('#clodinaryUpload').fileupload('option', 'formData').file = sourceURL;

    $('#clodinaryUpload').fileupload('add', { files: [ sourceURL ] });

    uploadData.submit();

    delete($('#clodinaryUpload').fileupload('option', 'formData').file);

    In above example I use global variable uploadData for storing form data that is passed to fileupload 'add' handler.

    0
    Comment actions Permalink

Please sign in to leave a comment.