diff --git a/e107_files/jslib/plupload/customUpload.js b/e107_files/jslib/plupload/customUpload.js new file mode 100644 index 000000000..e27b9e59b --- /dev/null +++ b/e107_files/jslib/plupload/customUpload.js @@ -0,0 +1,125 @@ +$(document).ready(function() + { + var path = $("#uploader").attr("rel"); + + $("#uploader").pluploadQueue({ + // General settings + runtimes : "html5,html4", + url : path, + max_file_size : "10mb", + chunk_size : "1mb", + unique_names : false, + + // Resize images on clientside if we can + resize : {width : 320, height : 240, quality : 90}, + + // Specify what files to browse for + filters : [ + {title : "Image files", extensions : "jpg,gif,png"}, + {title : "Zip files", extensions : "zip,gz"} + ] + , + // Error reporting etc + preinit: attachError, + setup: attachCallbacks + }); + + + + + + // Attach widget callbacks + function attachError(Uploader) { + Uploader.bind("FileUploaded", function(up, file, response) { + var data = $.parseJSON(response.response); + console.log("[FileUploaded] Response - " + response.response); + + if (data.error == 1) { + up.trigger("Error", {message: "'" + data.message + "'", file: file}); + console.log("[Error] " + file.id + " : " + data.message); + return false; + } + }); + } + + function attachCallbacks(uploader) { + + uploader.bind("Init", function(up) { + up.settings.multipart_params = { + "upload_type" : $("#uploadQueue").attr("data-uploadType"), + "xref_id" : $("#uploadQueue").attr("data-xrefID"), + "image_category" : $("#uploadQueue").attr("data-imageCategory") + }; + }); + + uploader.bind("UploadComplete", function(up, files) { + console.log("[UploadComplete]"); + + $(".plupload_buttons").css("display", "inline"); + $(".plupload_upload_status").css("display", "inline"); + $(".plupload_start").addClass("plupload_disabled"); + alert("it worked"); + up.refresh(); + }); + + + uploader.bind('FilesAdded', function(up, files) { + for (var i in files) { + alert(files[i].id + ' hello'); + //$('#' + files[i].id).append('hello'); + $('#' + files[i].id).prepend("WOWWs"); + // $('#' + files[i].id).html('