PHP
(quick guide & examples)
file_uploads=On post_max_size=10M upload_max_filesize=10M max_file_uploads=20
<form action="UP.PHP" onsubmit="return check();" enctype="multipart/form-data"> <input type="file" id="up" name="up" required> <input type="submit" value="Upload"> </form>
function check () { MAX FILE SIZE (BYTES) const max = 10000000; CHECK FILE SIZE let f = document.getElemenbyById ("up").files[0]; if (f.size <= max) { return true; } else { alert(`Over ${max} bytes.`); return false; } }
MAX ALLOWED SIZE $max = 10000000; SAVE ONLY IF UPLOADED FILE IS SMALLER if ($_FILES["up"]["size"] <= $max) { move_uploaded_file($_FILES["up"] ["tmp_name"], $_FILES["up"]["name"]) } else { echo "Over $max bytes"; }