Skip to content

Instantly share code, notes, and snippets.

@steverob
Created September 4, 2017 17:15
Show Gist options
  • Save steverob/14a0adb9ed012ebc50187a3a8bb96527 to your computer and use it in GitHub Desktop.
Save steverob/14a0adb9ed012ebc50187a3a8bb96527 to your computer and use it in GitHub Desktop.
jQuery File Upload BeforeAdd Hook
/*
* jQuery File Upload Processing Plugin
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2012, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
*/
/* jshint nomen:false */
/* global define, require, window */
;(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
define([
'jquery',
'./jquery.fileupload'
], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS:
factory(
require('jquery'),
require('./jquery.fileupload')
);
} else {
// Browser globals:
factory(
window.jQuery
);
}
}(function ($) {
'use strict';
// var originalAdd = $.blueimp.fileupload.prototype.options.add;
// The File Upload Processing plugin extends the fileupload widget
// with file processing functionality:
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
options: {
onBeforeAdd: function (e, data) {
// no-op
}
},
_onAdd: function (e, data) {
this.options.onBeforeAdd(e, data);
this._super(e, data);
}
});
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment