return $.ajax(uploadUrl, {
type: 'POST',
contentType: 'application/octet-stream',
- beforeSend: function(jqXhr) {
+ beforeSend: function(jqXhr, settings) {
jqXhr.setRequestHeader('Accept', 'application/js');
+ // attach proper File object
+ settings.data = blob;
},
xhr: function() {
var xhr = $.ajaxSettings.xhr();
function addInputFiles(inputEl) {
var clearedFileInput = $(inputEl).clone().val('');
- if ('FileReader' in window && inputEl.files) {
+ if (inputEl.files) {
// upload files using ajax
uploadAndAttachFiles(inputEl.files, inputEl);
$(inputEl).remove();