I implemented this plugin completely stock out of the box with a file limit of 2mb, enforced server side with an error response. It works great.
Then I was asked to up the file size limit to 5mb.
I tried everything I could find to try. I simply can't get the plugin to do anything with a file larger than 4.2mb.
No errors, it just doesn't do anything with a file larger than 4.2mb.
Code as it currently sits:
$('#fileupload').fileupload({
type: "POST",
add: function (e, data) {
if (files < 5) {
var errs = [];
var acceptFileTypes = /(\.|\/)(gif|jpe?g|png)$/i;
var maxFileSize = 5242880;
// Validate file
$.each(data.files, function (index, file) {
if (file.type.length && !acceptFileTypes.test(file.type)) {
errs.push('Selected file "' + file.name + '" is not alloawed. Invalid file type.');
}
if (this['size'] > maxFileSize) {
errs.push('Selected file "' + file.name + '" is too big, ' + parseInt(file.size / 1024 / 1024) + 'M.. File should be smaller than ' + parseInt(maxFileSize / 1024 / 1024) + 'M.');
}
});
// Output errors or submit data
if (errs.length > 0) {
alert('An error occured. ' + errs.join(" "));
} else {
data.context = $('<p/>').text('Uploading...').appendTo($('.currUploadDiv ul'));
data.submit();
removeFileUploadLabel();
files++;
if (files > 0) {
$('.fileName').html(files + ' of 5 uploads selected.')
} else {
$('.fileName').html('Select a file.');
}
}
//data.submit();
// return;
} else {
$('.fileName').html('Maximum number of files selected.');
};
},
success: function (e, data) {
//ToDo- check response for too many files uploaded.
},
done: function (e, data) {
data.context.text(data["_response"]["result"]["message"]);
},
error: function (e, data) {
console.log(e);
}
});
I've included the necessary .js files in the proper order (as indicated by a previous answer about MaxFileSize...)
What am I missing?