[Solved] How To Set File Size?

dota lavista Asks: How To Set File Size?
with this messages “Size maximum is 2 MB”

How to insert size validation on this action? i will make 2 upload files, so this is my code…

include 'koneksi.php';
$nama  = $_POST['nama'];
$kelas = $_POST['kelas'];
$alamat = $_POST['alamat'];

$rand1 = rand();
$rand2 = rand();

$allowed = array('pdf');

$filename1 = $_FILES['file1']['name'];
$filename2 = $_FILES['file2']['name'];

$ekstensi1 = pathinfo($filename1, PATHINFO_EXTENSION);
$ekstensi2 = pathinfo($filename2, PATHINFO_EXTENSION);

if($filename1 != "" && in_array($ekstensi1,$allowed)){
    move_uploaded_file($_FILES['file1']['tmp_name'], 'pdf1/'.$rand1.'_'.$filename1);
    $nama_file1 = $rand1.'_'.$filename1;
    $nama_file1 = "";

if($filename2 != "" && in_array($ekstensi2,$allowed)){
    move_uploaded_file($_FILES['file2']['tmp_name'], 'pdf2/'.$rand2.'_'.$filename2);
    $nama_file2 = $rand2.'_'.$filename2;
    $nama_file2 = "";
mysqli_query($koneksi, "insert into siswa values (NULL,'$nama','$kelas','$alamat','$nama_file1','$nama_file2')");

Thank you for helping

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.