javascript - Upload image to cloudinary and to my own server using jquery file upload -


i use jquery file upload upload images server. want test out cloudinary, during testing still want upload images own server well.

the code use uploading images server is:

$(function () {     $('#fileupload').fileupload({         url: '/upload/upload.ashx',         maxfilesize: 15000000,         acceptfiletypes: /(\.|\/)(jpe?g)$/i,         datatype: "json",         autoupload: true,         start: function (e) {             $('#progress').removeclass('hidden');         },         progress: function (e, data) {             var progress = parseint(data.loaded / data.total * 100, 10);             $('#progress .progress-bar').css('width', progress + '%');         },         always: function (e) {             $('#progress').addclass('hidden').fadeout("slow");         },         done: function (e, data) {             $('#progress').addclass('hidden');             parent.location.reload();         },     })     .bind('fileuploadadd', function (e, data) {         $('#error').addclass('hidden');     })     .bind('fileuploadprocessfail', function (e, data) {         var currentfile = data.files[data.index];         if (data.files.error && currentfile.error) {             $('#error').html('error: ' + data.files[data.index].error);             $('#error').removeclass('hidden');         }     }) }); 

the code uploading using cloudinary is:

$('#fileupload').unsigned_cloudinary_upload('test12345',     { cloud_name: 'test' } ).bind('cloudinarystart', function (e, data) {     $('#progress').show(); } ).bind('cloudinaryprogress', function (e, data) {     $('.progress-bar').css('width',         math.round((data.loaded * 100.0) / data.total) + '%'); } ).bind('cloudinarydone', function (e, data) {     $('#progress').hide();     parent.location.reload(); }); 

now i'm searching way both same time or after each other.

what tried?

i tried putting code cloudinary in "done" part of jquery file upload code not working. tried destroyed fileupload first , start cloudinary code, not working. tried play jquery when/then, still no succes. searched google , stackoverflow can not find need.

the first part of uploading (fileupload) working. cloudinary part not. no errors in console window.

i need way combine scripts.. can me out?

update

i fixed running first script , in upload.ashx uploading cloudinay asp.net. working.

public static uploadresult uploadimage(string tags, string filename, stream stream) {     var uploadparams = new imageuploadparams()     {         file = new filedescription(filename, stream),         publicid = filename,         tags = tags,         uploadpreset = "test12345",     };      var result = new cloudinary(getaccount()).upload(uploadparams);     return new uploadresult     {         uri = result.secureuri,         error = result.error != null ? result.error.message : string.empty     }; } 

when "not working", mean cloudinarydone event isn't fired @ after successful upload? because should, , should able details of , pass server. here's example: https://jsfiddle.net/taragano/70dd9vd4/

alternatively, , may more recommended approach, can upload image server first, , server-side upload, i.e., have server upload image directly cloudinary account.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -