The most obvious option is a few lines of Javascript added to your HTML, which will be your first line of defense:
var uploadField = document.getElementById("file");
uploadField.onchange = function() {
if(this.files[0].size > 100000){
alert("File is too big!");
this.value = "";
};
};
If you also make sure that your form can only be submitted via javascript:
http://javascript-coder.com/javascript-form/javascript-form-submit.phtml
Thus, the user cannot simply turn off Javascript and load any desired size.
Perhaps it will be possible using the chunk process to load your file into chunks instead of one large file, but I don't think I tried to limit the file size this way before ...
source
share