function upload_check()
{
const oFile = document.getElementById("file").files[0].size;
var max = document.getElementById("max_id").value;
var maxerr = document.getElementById("error");
if(Math.round(oFile/1024) > max && max != '')
{
maxerr.className = 'alert alert-danger';
maxerr.innerHTML = 'Максимальный размер: ' + max + ' мб';
oFile.value = "";
}
else
{
maxerr.className = '';
maxerr.innerHTML = '';
}
};
<div id="error" style="margin-top: .5rem;"></div>
<input onchange="upload_check()" type="file" name="file" id="file" required>
<input id="max_id" type="hidden" name="MAX_FILE_SIZE" value="<?php echo (@$_GET['method'] == "curl" or !isset($_GET['method'])) ? 64000 : null; ?>" />