When uploading big file (>100M) to server, PHP always accept entire data POST from browser first. We cannot inject into the process of uploading.
For example, check
I suggest you to use some client side plugins to upload files. You could use
http://www.plupload.com/
or
https://github.com/blueimp/jQuery-File-Upload/
Both plugins have provision to check file size before uploading.
If you want to use your own scripts, check this. This may help you
function readfile()
{
var files = document.getElementById("fileForUpload").files;
var output = [];
for (var i = 0, f; f = files[i]; i++)
{
if(f.size < 100000) // Check file size of file
{
// Your code for upload
}
else
{
alert('File size exceeds upload size limit');
}
}
}