Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
plupload base
(function($,window,document,undefined)
{
var i = {
plupload : function(seccion,contenedor,botonBuscar,listaUpload,limite)
{
var uploader = new plupload.Uploader({
runtimes : 'gears,html5,flash,silverlight,browserplus',
browse_button : botonBuscar,
container : contenedor,
max_file_size : '10mb',
url : i.urlIndex+'admin/uploadify/'+seccion,
flash_swf_url : i.urlIndex+'/plupload/plupload.flash.swf',
silverlight_xap_url : i.urlIndex+'/plupload/plupload.silverlight.xap',
filters : [
{title : "Image files", extensions : "jpg,gif,png,jpeg"},
{title : "PDF files", extensions : "pdf"}
],
multi_selection : (limite==null)?true:limite,
// Post init events, bound after the internal events
init :
{
StateChanged: function(up) {
// Called when the state of the queue is changed
//log('[StateChanged]', up.state == plupload.STARTED ? "STARTED" : "STOPPED");
},
QueueChanged: function(up) {
// Called when the files in queue are changed by adding/removing files
//log('[QueueChanged]');
},
UploadProgress: function(up, file) {
// Called while a file is being uploaded
//log('[UploadProgress]', 'File:', file, "Total:", up.total);
},
FilesAdded: function(up, files)
{
$.each(files, function(i, file)
{
console.log(files,i,file);
});
up.refresh(); // Reposition Flash/Silverlight
uploader.start();
},
FileUploaded: function(up, file, info)
{
// Called when a file has finished uploading
//log('[FileUploaded] File:', file, "Info:", info);
console.log(up,file,info);
},
UploadComplete : function(up,args)
{
console.log(up,file,info)
},
Error: function(up, err)
{
console.log(up,err);
up.refresh();
}
}
});
uploader.init();
},
pluploadImg: function()
{
// _this.plupload('seccion','contenedor','botonBuscar','botonSubir','divLista');
this.plupload('usados','container','pickfiles','filelist');
}
init : function()
{
this.pluploadImg();
}
}
i.init();
})(jQuery,window,document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.