get uploaded file size in bytes in php

You can check like this

<?php
if(isset($_FILES['file']) {
    if($_FILES['file']['size'] > 10485760) { //10 MB (size is also in bytes)
        // File too big
    } else {
        // File within size restrictions
    }
}

check this out http://www.w3schools.com/php/php_file_upload.asp


Your code is right, the below line will give you the size in bytes:

size=$_FILES['image']['size'];

You can also get the file size after the file has been uploaded this way:

echo filesize($perDestination) . ' bytes';  

This option will also give you the file size in bytes

Tags:

Php